Skip to content

Commit d6a9b51

Browse files
committedSep 12, 2017
Remove Lua functions from WorldEdit GUI
1 parent 3c61759 commit d6a9b51

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed
 

Diff for: ‎worldedit_gui/functionality.lua

+3-33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--saved state for each player
2-
local gui_nodename1 = {} --mapping of player names to node names (arbitrary strings may also appear as values)
3-
local gui_nodename2 = {} --mapping of player names to node names (arbitrary strings may also appear as values)
2+
local gui_nodename1 = {} --mapping of player names to node names
3+
local gui_nodename2 = {} --mapping of player names to node names
44
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)
55
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)
66
local gui_distance1 = {} --mapping of player names to a distance (arbitrary strings may also appear as values)
@@ -10,9 +10,7 @@ local gui_count1 = {} --mapping of player names to a quantity (arbitrary strings
1010
local gui_count2 = {} --mapping of player names to a quantity (arbitrary strings may also appear as values)
1111
local gui_count3 = {} --mapping of player names to a quantity (arbitrary strings may also appear as values)
1212
local gui_angle = {} --mapping of player names to an angle (one of 90, 180, 270, representing the angle in degrees clockwise)
13-
local gui_filename = {} --mapping of player names to file names (arbitrary strings may also appear as values)
14-
local gui_formspec = {} --mapping of player names to formspecs
15-
local gui_code = {} --mapping of player names to formspecs
13+
local gui_filename = {} --mapping of player names to file names
1614

1715
--set default values
1816
setmetatable(gui_nodename1, {__index = function() return "Cobblestone" end})
@@ -27,8 +25,6 @@ setmetatable(gui_count2, {__index = function() return "6" end})
2725
setmetatable(gui_count3, {__index = function() return "4" end})
2826
setmetatable(gui_angle, {__index = function() return 90 end})
2927
setmetatable(gui_filename, {__index = function() return "building" end})
30-
setmetatable(gui_formspec, {__index = function() return "size[5,5]\nlabel[0,0;Hello, world!]" end})
31-
setmetatable(gui_code, {__index = function() return "minetest.chat_send_player(\"singleplayer\", \"Hello, world!\")" end})
3228

3329
local axis_indices = {["X axis"]=1, ["Y axis"]=2, ["Z axis"]=3, ["Look direction"]=4}
3430
local axis_values = {"x", "y", "z", "?"}
@@ -739,32 +735,6 @@ worldedit.register_gui_handler("worldedit_gui_save_load", function(name, fields)
739735
return false
740736
end)
741737

742-
worldedit.register_gui_function("worldedit_gui_lua", {
743-
name = "Run Lua",
744-
privs = we_privs("lua"),
745-
get_formspec = function(name)
746-
local code = gui_code[name]
747-
return "size[8,6.5]" .. worldedit.get_formspec_header("worldedit_gui_lua") ..
748-
string.format("textarea[0.5,1;7.5,5.5;worldedit_gui_lua_code;Lua Code;%s]", minetest.formspec_escape(code)) ..
749-
"button_exit[0,6;3,0.8;worldedit_gui_lua_run;Run Lua]" ..
750-
"button_exit[5,6;3,0.8;worldedit_gui_lua_transform;Lua Transform]"
751-
end,
752-
})
753-
754-
worldedit.register_gui_handler("worldedit_gui_lua", function(name, fields)
755-
if fields.worldedit_gui_lua_run or fields.worldedit_gui_lua_transform then
756-
gui_code[name] = fields.worldedit_gui_lua_code
757-
worldedit.show_page(name, "worldedit_gui_lua")
758-
if fields.worldedit_gui_lua_run then
759-
minetest.chatcommands["/lua"].func(name, gui_code[name])
760-
else --fields.worldedit_gui_lua_transform
761-
minetest.chatcommands["/luatransform"].func(name, gui_code[name])
762-
end
763-
return true
764-
end
765-
return false
766-
end)
767-
768738
worldedit.register_gui_function("worldedit_gui_clearobjects", {
769739
name = "Clear Objects",
770740
privs = we_privs("clearobjects"),

0 commit comments

Comments
 (0)
Please sign in to comment.