summaryrefslogtreecommitdiff
path: root/doc/lua_api.txt
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-07 00:03:42 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-07 00:05:00 +0300
commit81554fbf720300e36060a628c786902918328612 (patch)
treec5b784bd1f7bfb03b8c2b773a42daf9bb910e8ef /doc/lua_api.txt
parenta435cfcd82ccb138cbb05facdf3408335c638720 (diff)
downloadminetest-81554fbf720300e36060a628c786902918328612.tar.gz
minetest-81554fbf720300e36060a628c786902918328612.tar.bz2
minetest-81554fbf720300e36060a628c786902918328612.zip
Add minetest.serialize() and minetest.deserialize()
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r--doc/lua_api.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 16587144d..61bc8e1c2 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -805,6 +805,17 @@ minetest.get_item_group(name, group) -> rating
^ Get rating of a group of an item. (0 = not in group)
minetest.get_node_group(name, group) -> rating
^ Deprecated: An alias for the former.
+minetest.serialize(table) -> string
+^ Convert a table containing tables, strings, numbers, booleans and nils
+ into string form readable by minetest.deserialize
+^ Example: serialize({foo='bar'}) -> 'return { ["foo"] = "bar" }'
+minetest.deserialize(string) -> table
+^ Convert a string returned by minetest.deserialize into a table
+^ String is loaded in an empty sandbox environment.
+^ Will load functions, but they cannot access the global environment.
+^ Example: deserialize('return { ["foo"] = "bar" }') -> {foo='bar'}
+^ Example: deserialize('print("foo")') -> nil (function call fails)
+ ^ error:[string "print("foo")"]:1: attempt to call global 'print' (a nil value)
Global objects:
minetest.env - EnvRef of the server environment and world.