aboutsummaryrefslogtreecommitdiff
path: root/builtin/common/serialize.lua
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-05-08 23:56:36 -0400
committerShadowNinja <shadowninja@minetest.net>2014-05-24 17:32:42 -0400
commit882e12f8ab5307a7814a0b6646ef7db9b448c236 (patch)
tree726db008312cfff9906388a97d00a4c0e5ffd755 /builtin/common/serialize.lua
parent660e63688761dc08558de030a53464d39a6ec85f (diff)
downloadminetest-882e12f8ab5307a7814a0b6646ef7db9b448c236.tar.gz
minetest-882e12f8ab5307a7814a0b6646ef7db9b448c236.tar.bz2
minetest-882e12f8ab5307a7814a0b6646ef7db9b448c236.zip
Rework dumping functions
Changes: * Add comments to explain the dumping code * Add support for dumping values of any type (as '<' <type> '>') * Add support for tables as keys in dump2() * Make dump2() return it's result (like dump()) rather than printing it * Simplify and optimize function serialization via serialize()
Diffstat (limited to 'builtin/common/serialize.lua')
-rw-r--r--builtin/common/serialize.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/common/serialize.lua b/builtin/common/serialize.lua
index 6cb94709c..1deee43a4 100644
--- a/builtin/common/serialize.lua
+++ b/builtin/common/serialize.lua
@@ -113,7 +113,7 @@ function core.serialize(x)
elseif t=="string" then return string.format("%q", x)
elseif t=="boolean" then return x and "true" or "false"
elseif t=="function" then
- return "loadstring("..string.format("%q", string.dump(x))..")"
+ return string.format("loadstring(%q)", string.dump(x))
elseif t=="table" then
local acc = { }
local idx_dumped = { }