compatibility with lua 5.1 (in lua 5.1 -> tostring(val, stack) returns tostring(val)..tostring(stack), but in lua>5.1 it returns just tostring(val).

pull/10/head
spiiin 2018-04-22 21:14:10 +03:00
parent bee7ee3431
commit e792cd0336
1 changed files with 5 additions and 1 deletions

View File

@ -111,13 +111,17 @@ local function encode_number(val)
return string.format("%.14g", val)
end
local function encode_bool(val)
return tostring(val)
end
local type_func_map = {
[ "nil" ] = encode_nil,
[ "table" ] = encode_table,
[ "string" ] = encode_string,
[ "number" ] = encode_number,
[ "boolean" ] = tostring,
[ "boolean" ] = encode_bool,
}