--saved state for each player\r
-local gui_nodename1 = {} --mapping of player names to node names (arbitrary strings may also appear as values)\r
-local gui_nodename2 = {} --mapping of player names to node names (arbitrary strings may also appear as values)\r
+local gui_nodename1 = {} --mapping of player names to node names\r
+local gui_nodename2 = {} --mapping of player names to node names\r
local gui_axis1 = {} --mapping of player names to axes (one of 1, 2, 3, or 4, representing the axes in the `axis_indices` table below)\r
local gui_axis2 = {} --mapping of player names to axes (one of 1, 2, 3, or 4, representing the axes in the `axis_indices` table below)\r
local gui_distance1 = {} --mapping of player names to a distance (arbitrary strings may also appear as values)\r
local gui_count2 = {} --mapping of player names to a quantity (arbitrary strings may also appear as values)\r
local gui_count3 = {} --mapping of player names to a quantity (arbitrary strings may also appear as values)\r
local gui_angle = {} --mapping of player names to an angle (one of 90, 180, 270, representing the angle in degrees clockwise)\r
-local gui_filename = {} --mapping of player names to file names (arbitrary strings may also appear as values)\r
-local gui_formspec = {} --mapping of player names to formspecs\r
-local gui_code = {} --mapping of player names to formspecs\r
+local gui_filename = {} --mapping of player names to file names\r
\r
--set default values\r
setmetatable(gui_nodename1, {__index = function() return "Cobblestone" end})\r
setmetatable(gui_count3, {__index = function() return "4" end})\r
setmetatable(gui_angle, {__index = function() return 90 end})\r
setmetatable(gui_filename, {__index = function() return "building" end})\r
-setmetatable(gui_formspec, {__index = function() return "size[5,5]\nlabel[0,0;Hello, world!]" end})\r
-setmetatable(gui_code, {__index = function() return "minetest.chat_send_player(\"singleplayer\", \"Hello, world!\")" end})\r
\r
local axis_indices = {["X axis"]=1, ["Y axis"]=2, ["Z axis"]=3, ["Look direction"]=4}\r
local axis_values = {"x", "y", "z", "?"}\r
return false\r
end)\r
\r
-worldedit.register_gui_function("worldedit_gui_lua", {\r
- name = "Run Lua",\r
- privs = we_privs("lua"),\r
- get_formspec = function(name)\r
- local code = gui_code[name]\r
- return "size[8,6.5]" .. worldedit.get_formspec_header("worldedit_gui_lua") ..\r
- string.format("textarea[0.5,1;7.5,5.5;worldedit_gui_lua_code;Lua Code;%s]", minetest.formspec_escape(code)) ..\r
- "button_exit[0,6;3,0.8;worldedit_gui_lua_run;Run Lua]" ..\r
- "button_exit[5,6;3,0.8;worldedit_gui_lua_transform;Lua Transform]"\r
- end,\r
-})\r
-\r
-worldedit.register_gui_handler("worldedit_gui_lua", function(name, fields)\r
- if fields.worldedit_gui_lua_run or fields.worldedit_gui_lua_transform then\r
- gui_code[name] = fields.worldedit_gui_lua_code\r
- worldedit.show_page(name, "worldedit_gui_lua")\r
- if fields.worldedit_gui_lua_run then\r
- minetest.chatcommands["/lua"].func(name, gui_code[name])\r
- else --fields.worldedit_gui_lua_transform\r
- minetest.chatcommands["/luatransform"].func(name, gui_code[name])\r
- end\r
- return true\r
- end\r
- return false\r
-end)\r
-\r
worldedit.register_gui_function("worldedit_gui_clearobjects", {\r
name = "Clear Objects",\r
privs = we_privs("clearobjects"),\r