]> git.lizzy.rs Git - worldedit.git/commitdiff
All commands in WorldEdit are now accessible through WorldEdit GUI, except the MT...
authorUberi <azhang9@gmail.com>
Fri, 20 Dec 2013 23:42:47 +0000 (18:42 -0500)
committerUberi <azhang9@gmail.com>
Fri, 20 Dec 2013 23:42:47 +0000 (18:42 -0500)
worldedit_gui/functionality.lua

index 28bf7231805925d971af7924f02c9bb85b499e21..4756b344bf71b05aa5697d5837995e7927c1eec2 100644 (file)
@@ -1,26 +1,45 @@
 --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_axis = {} --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, usually side length (arbitrary strings may also appear as values)\r
-local gui_distance2 = {} --mapping of player names to a distance, usually radius (arbitrary strings may also appear as values)\r
-local gui_distance3 = {} --mapping of player names to a distance, usually spacing (arbitrary strings may also appear as values)\r
-local gui_formspec = {} --mapping of player names to formspecs (arbitrary strings may also appear as values)\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_distance2 = {} --mapping of player names to a distance (arbitrary strings may also appear as values)\r
+local gui_distance3 = {} --mapping of player names to a distance (arbitrary strings may also appear as values)\r
+local gui_count1 = {} --mapping of player names to a quantity (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
 \r
 --set default values\r
-setmetatable(gui_nodename1, {__index = function () return "Cobblestone" end})\r
-setmetatable(gui_nodename2, {__index = function () return "Stone" end})\r
-setmetatable(gui_axis, {__index = function () return 4 end})\r
-setmetatable(gui_distance1, {__index = function () return "10" end})\r
-setmetatable(gui_distance2, {__index = function () return "5" end})\r
-setmetatable(gui_distance3, {__index = function () return "2" end})\r
-setmetatable(gui_formspec, {__index = function () return "" end})\r
+setmetatable(gui_nodename1, {__index = function() return "Cobblestone" end})\r
+setmetatable(gui_nodename2, {__index = function() return "Stone" end})\r
+setmetatable(gui_axis1,     {__index = function() return 4 end})\r
+setmetatable(gui_axis2,     {__index = function() return 1 end})\r
+setmetatable(gui_distance1, {__index = function() return "10" end})\r
+setmetatable(gui_distance2, {__index = function() return "5" end})\r
+setmetatable(gui_distance3, {__index = function() return "2" end})\r
+setmetatable(gui_count1,     {__index = function() return "3" end})\r
+setmetatable(gui_count2,     {__index = function() return "6" 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
 setmetatable(axis_indices, {__index = function () return 4 end})\r
 setmetatable(axis_values, {__index = function () return "?" end})\r
 \r
+local angle_indices = {["90 degrees"]=1, ["180 degrees"]=2, ["270 degrees"]=3}\r
+local angle_values = {90, 180, 270}\r
+setmetatable(angle_indices, {__index = function () return 1 end})\r
+setmetatable(angle_values, {__index = function () return 90 end})\r
+\r
 --given multiple sets of privileges, produces a single set of privs that would have the same effect as requiring all of them at the same time\r
 local combine_privs = function(...)\r
        local result = {}\r
@@ -231,7 +250,7 @@ end)
 worldedit.register_gui_function("worldedit_gui_cylinder", {\r
        name = "Cylinder", privs = combine_privs(minetest.chatcommands["/hollowcylinder"].privs, minetest.chatcommands["/cylinder"].privs),\r
        get_formspec = function(name)\r
-               local node, axis, length, radius = gui_nodename1[name], gui_axis[name], gui_distance1[name], gui_distance2[name]\r
+               local node, axis, length, radius = gui_nodename1[name], gui_axis1[name], gui_distance1[name], gui_distance2[name]\r
                local nodename = worldedit.normalize_nodename(node)\r
                return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_cylinder") ..\r
                        string.format("field[0.5,1.5;4,0.8;worldedit_gui_cylinder_node;Name;%s]", minetest.formspec_escape(node)) ..\r
@@ -250,14 +269,14 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields)
        if fields.worldedit_gui_cylinder_search\r
        or fields.worldedit_gui_cylinder_submit_hollow or fields.worldedit_gui_cylinder_submit_solid then\r
                gui_nodename1[name] = tostring(fields.worldedit_gui_cylinder_node)\r
-               gui_axis[name] = axis_indices[fields.worldedit_gui_cylinder_axis]\r
+               gui_axis1[name] = axis_indices[fields.worldedit_gui_cylinder_axis]\r
                gui_distance1[name] = tostring(fields.worldedit_gui_cylinder_length)\r
                gui_distance2[name] = tostring(fields.worldedit_gui_cylinder_radius)\r
                worldedit.show_page(name, "worldedit_gui_cylinder")\r
                if fields.worldedit_gui_cylinder_submit_hollow then\r
-                       minetest.chatcommands["/hollowcylinder"].func(name, string.format("%s %s %s %s", axis_values[gui_axis[name]], gui_distance1[name], gui_distance2[name], gui_nodename1[name]))\r
+                       minetest.chatcommands["/hollowcylinder"].func(name, string.format("%s %s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_distance2[name], gui_nodename1[name]))\r
                elseif fields.worldedit_gui_cylinder_submit_solid then\r
-                       minetest.chatcommands["/cylinder"].func(name, string.format("%s %s %s %s", axis_values[gui_axis[name]], gui_distance1[name], gui_distance2[name], gui_nodename1[name]))\r
+                       minetest.chatcommands["/cylinder"].func(name, string.format("%s %s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_distance2[name], gui_nodename1[name]))\r
                end\r
                return true\r
        end\r
@@ -267,7 +286,7 @@ end)
 worldedit.register_gui_function("worldedit_gui_pyramid", {\r
        name = "Pyramid", privs = minetest.chatcommands["/pyramid"].privs,\r
        get_formspec = function(name)\r
-               local node, axis, length = gui_nodename1[name], gui_axis[name], gui_distance1[name]\r
+               local node, axis, length = gui_nodename1[name], gui_axis1[name], gui_distance1[name]\r
                local nodename = worldedit.normalize_nodename(node)\r
                return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_pyramid") ..\r
                        string.format("field[0.5,1.5;4,0.8;worldedit_gui_pyramid_node;Name;%s]", minetest.formspec_escape(node)) ..\r
@@ -283,11 +302,11 @@ worldedit.register_gui_function("worldedit_gui_pyramid", {
 worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields)\r
        if fields.worldedit_gui_pyramid_search or fields.worldedit_gui_pyramid_submit then\r
                gui_nodename1[name] = tostring(fields.worldedit_gui_pyramid_node)\r
-               gui_axis[name] = axis_indices[fields.worldedit_gui_pyramid_axis]\r
+               gui_axis1[name] = axis_indices[fields.worldedit_gui_pyramid_axis]\r
                gui_distance1[name] = tostring(fields.worldedit_gui_pyramid_length)\r
                worldedit.show_page(name, "worldedit_gui_pyramid")\r
                if fields.worldedit_gui_pyramid_submit then\r
-                       minetest.chatcommands["/pyramid"].func(name, string.format("%s %s %s", axis_values[gui_axis[name]], gui_distance1[name], gui_nodename1[name]))\r
+                       minetest.chatcommands["/pyramid"].func(name, string.format("%s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_nodename1[name]))\r
                end\r
                return true\r
        end\r
@@ -329,7 +348,7 @@ end)
 worldedit.register_gui_function("worldedit_gui_copy_move", {\r
        name = "Copy/Move", privs = combine_privs(minetest.chatcommands["/copy"].privs, minetest.chatcommands["/move"].privs),\r
        get_formspec = function(name)\r
-               local axis = gui_axis[name] or 4\r
+               local axis = gui_axis1[name] or 4\r
                local amount = gui_distance1[name] or "10"\r
                return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_copy_move") ..\r
                        string.format("field[0.5,1.5;4,0.8;worldedit_gui_copy_move_amount;Amount;%s]", minetest.formspec_escape(amount)) ..\r
@@ -341,23 +360,286 @@ worldedit.register_gui_function("worldedit_gui_copy_move", {
 \r
 worldedit.register_gui_handler("worldedit_gui_copy_move", function(name, fields)\r
        if fields.worldedit_gui_copy_move_copy or fields.worldedit_gui_copy_move_move then\r
-               gui_axis[name] = axis_indices[fields.worldedit_gui_cylinder_axis] or 4\r
+               gui_axis1[name] = axis_indices[fields.worldedit_gui_cylinder_axis] or 4\r
                gui_distance1[name] = tostring(fields.worldedit_gui_copy_move_amount)\r
                worldedit.show_page(name, "worldedit_gui_copy_move")\r
                if fields.worldedit_gui_copy_move_copy then\r
-                       minetest.chatcommands["/copy"].func(name, string.format("%s %s", axis_values[gui_axis[name]], gui_distance1[name]))\r
+                       minetest.chatcommands["/copy"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_distance1[name]))\r
                else --fields.worldedit_gui_copy_move_move\r
-                       minetest.chatcommands["/move"].func(name, string.format("%s %s", axis_values[gui_axis[name]], gui_distance1[name]))\r
+                       minetest.chatcommands["/move"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_distance1[name]))\r
                end\r
                return true\r
        end\r
        return false\r
 end)\r
 \r
+worldedit.register_gui_function("worldedit_gui_stack", {\r
+       name = "Stack", privs = minetest.chatcommands["/stack"].privs,\r
+       get_formspec = function(name)\r
+               local axis, count = gui_axis1[name], gui_count1[name]\r
+               return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_stack") ..\r
+                       string.format("field[0.5,1.5;4,0.8;worldedit_gui_stack_count;Count;%s]", minetest.formspec_escape(count)) ..\r
+                       string.format("dropdown[4,1.18;2.5;worldedit_gui_stack_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_stack_submit;Stack]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_stack", function(name, fields)\r
+       if fields.worldedit_gui_stack_submit then\r
+               gui_axis1[name] = axis_indices[fields.worldedit_gui_stack_axis]\r
+               gui_count1[name] = tostring(fields.worldedit_gui_stack_count)\r
+               worldedit.show_page(name, "worldedit_gui_stack")\r
+               minetest.chatcommands["/stack"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_count1[name]))\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_stretch", {\r
+       name = "Stretch", privs = minetest.chatcommands["/stretch"].privs,\r
+       get_formspec = function(name)\r
+               local stretchx, stretchy, stretchz = gui_count1[name], gui_count2[name], gui_count3[name]\r
+               return "size[5,5]" .. worldedit.get_formspec_header("worldedit_gui_stretch") ..\r
+                       string.format("field[0.5,1.5;4,0.8;worldedit_gui_stretch_x;Stretch X;%s]", minetest.formspec_escape(stretchx)) ..\r
+                       string.format("field[0.5,2.5;4,0.8;worldedit_gui_stretch_y;Stretch Y;%s]", minetest.formspec_escape(stretchy)) ..\r
+                       string.format("field[0.5,3.5;4,0.8;worldedit_gui_stretch_z;Stretch Z;%s]", minetest.formspec_escape(stretchz)) ..\r
+                       "button_exit[0,4.5;3,0.8;worldedit_gui_stretch_submit;Stretch]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_stretch", function(name, fields)\r
+       if fields.worldedit_gui_stretch_submit then\r
+               gui_count1[name] = tostring(fields.worldedit_gui_stretch_x)\r
+               gui_count2[name] = tostring(fields.worldedit_gui_stretch_y)\r
+               gui_count3[name] = tostring(fields.worldedit_gui_stretch_z)\r
+               worldedit.show_page(name, "worldedit_gui_stretch")\r
+               minetest.chatcommands["/stretch"].func(name, string.format("%s %s %s", gui_count1[name], gui_count2[name], gui_count3[name]))\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_transpose", {\r
+       name = "Transpose", privs = minetest.chatcommands["/transpose"].privs,\r
+       get_formspec = function(name)\r
+               local axis1, axis2 = gui_axis1[name], gui_axis2[name]\r
+               return "size[5.5,3]" .. worldedit.get_formspec_header("worldedit_gui_transpose") ..\r
+                       string.format("dropdown[0,1;2.5;worldedit_gui_transpose_axis1;X axis,Y axis,Z axis,Look direction;%d]", axis1) ..\r
+                       string.format("dropdown[3,1;2.5;worldedit_gui_transpose_axis2;X axis,Y axis,Z axis,Look direction;%d]", axis2) ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_transpose_submit;Transpose]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_transpose", function(name, fields)\r
+       if fields.worldedit_gui_transpose_submit then\r
+               gui_axis1[name] = axis_indices[fields.worldedit_gui_transpose_axis1]\r
+               gui_axis2[name] = axis_indices[fields.worldedit_gui_transpose_axis2]\r
+               worldedit.show_page(name, "worldedit_gui_transpose")\r
+               minetest.chatcommands["/transpose"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], axis_values[gui_axis2[name]]))\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_flip", {\r
+       name = "Flip", privs = minetest.chatcommands["/flip"].privs,\r
+       get_formspec = function(name)\r
+               local axis = gui_axis2[name]\r
+               return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_flip") ..\r
+                       string.format("dropdown[0,1;2.5;worldedit_gui_flip_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_flip_submit;Flip]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_flip", function(name, fields)\r
+       if fields.worldedit_gui_flip_submit then\r
+               gui_axis2[name] = axis_indices[fields.worldedit_gui_flip_axis]\r
+               worldedit.show_page(name, "worldedit_gui_flip")\r
+               minetest.chatcommands["/flip"].func(name, axis_values[gui_axis2[name]])\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_rotate", {\r
+       name = "Rotate", privs = minetest.chatcommands["/rotate"].privs,\r
+       get_formspec = function(name)\r
+               local axis, angle = gui_axis1[name], gui_angle[name]\r
+               return "size[5.5,3]" .. worldedit.get_formspec_header("worldedit_gui_rotate") ..\r
+                       string.format("dropdown[0,1;2.5;worldedit_gui_rotate_angle;90 degrees,180 degrees,270 degrees;%s]", angle) ..\r
+                       string.format("dropdown[3,1;2.5;worldedit_gui_rotate_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_rotate_submit;Rotate]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_rotate", function(name, fields)\r
+       if fields.worldedit_gui_rotate_submit then\r
+               gui_axis1[name] = axis_indices[fields.worldedit_gui_rotate_axis]\r
+               gui_angle[name] = angle_indices[fields.worldedit_gui_rotate_angle]\r
+               worldedit.show_page(name, "worldedit_gui_rotate")\r
+               minetest.chatcommands["/rotate"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], angle_values[gui_angle[name]]))\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_orient", {\r
+       name = "Orient", privs = minetest.chatcommands["/orient"].privs,\r
+       get_formspec = function(name)\r
+               local angle = gui_angle[name]\r
+               return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_orient") ..\r
+                       string.format("dropdown[0,1;2.5;worldedit_gui_rotate_angle;90 degrees,180 degrees,270 degrees;%s]", angle) ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_orient_submit;Orient]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_orient", function(name, fields)\r
+       if fields.worldedit_gui_orient_submit then\r
+               gui_angle[name] = angle_indices[fields.worldedit_gui_orient_angle]\r
+               worldedit.show_page(name, "worldedit_gui_orient")\r
+               minetest.chatcommands["/orient"].func(name, angle_values[gui_angle[name]])\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_fixlight", {\r
+       name = "Fix Lighting", privs = minetest.chatcommands["/fixlight"].privs,\r
+       on_select = function(name)\r
+               minetest.chatcommands["/fixlight"].func(name, "")\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_function("worldedit_gui_hide", {\r
+       name = "Hide Region", privs = minetest.chatcommands["/hide"].privs,\r
+       on_select = function(name)\r
+               minetest.chatcommands["/hide"].func(name, "")\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_function("worldedit_gui_suppress", {\r
+       name = "Suppress Nodes", privs = minetest.chatcommands["/suppress"].privs,\r
+       get_formspec = function(name)\r
+               local node = gui_nodename1[name]\r
+               local nodename = worldedit.normalize_nodename(node)\r
+               return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_suppress") ..\r
+                       string.format("field[0.5,1.5;4,0.8;worldedit_gui_suppress_node;Name;%s]", minetest.formspec_escape(node)) ..\r
+                       "button[4,1.18;1.5,0.8;worldedit_gui_suppress_search;Search]" ..\r
+                       (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)\r
+                               or "image[5.5,1.1;1,1;unknown_node.png]") ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_suppress_submit;Suppress Nodes]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_suppress", function(name, fields)\r
+       if fields.worldedit_gui_suppress_search or fields.worldedit_gui_suppress_submit then\r
+               gui_nodename1[name] = tostring(fields.worldedit_gui_suppress_node)\r
+               worldedit.show_page(name, "worldedit_gui_suppress")\r
+               if fields.worldedit_gui_suppress_submit then\r
+                       minetest.chatcommands["/suppress"].func(name, gui_nodename1[name])\r
+               end\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_highlight", {\r
+       name = "Highlight Nodes", privs = minetest.chatcommands["/highlight"].privs,\r
+       get_formspec = function(name)\r
+               local node = gui_nodename1[name]\r
+               local nodename = worldedit.normalize_nodename(node)\r
+               return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_highlight") ..\r
+                       string.format("field[0.5,1.5;4,0.8;worldedit_gui_highlight_node;Name;%s]", minetest.formspec_escape(node)) ..\r
+                       "button[4,1.18;1.5,0.8;worldedit_gui_highlight_search;Search]" ..\r
+                       (nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)\r
+                               or "image[5.5,1.1;1,1;unknown_node.png]") ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_highlight_submit;Highlight Nodes]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_highlight", function(name, fields)\r
+       if fields.worldedit_gui_highlight_search or fields.worldedit_gui_highlight_submit then\r
+               gui_nodename1[name] = tostring(fields.worldedit_gui_highlight_node)\r
+               worldedit.show_page(name, "worldedit_gui_highlight")\r
+               if fields.worldedit_gui_highlight_submit then\r
+                       minetest.chatcommands["/highlight"].func(name, gui_nodename1[name])\r
+               end\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_restore", {\r
+       name = "Restore Region", privs = minetest.chatcommands["/restore"].privs,\r
+       on_select = function(name)\r
+               minetest.chatcommands["/restore"].func(name, "")\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_function("worldedit_gui_save_load", {\r
+       name = "Save/Load", privs = combine_privs(minetest.chatcommands["/save"].privs, minetest.chatcommands["/allocate"].privs, minetest.chatcommands["/load"].privs),\r
+       get_formspec = function(name)\r
+               local filename = gui_filename[name]\r
+               return "size[6,4]" .. worldedit.get_formspec_header("worldedit_gui_save_load") ..\r
+                       string.format("field[0.5,1.5;4,0.8;worldedit_gui_save_filename;Filename;%s]", minetest.formspec_escape(filename)) ..\r
+                       "button_exit[0,2.5;3,0.8;worldedit_gui_save_load_submit_save;Save]" ..\r
+                       "button_exit[3,2.5;3,0.8;worldedit_gui_save_load_submit_allocate;Allocate]" ..\r
+                       "button_exit[0,3.5;3,0.8;worldedit_gui_save_load_submit_load;Load]"\r
+       end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_save", function(name, fields)\r
+       if fields.worldedit_gui_save_load_submit_save or worldedit_gui_save_load_submit_allocate or worldedit_gui_save_load_submit_load then\r
+               gui_filename[name] = tostring(fields.worldedit_gui_save_axis)\r
+               worldedit.show_page(name, "worldedit_gui_save_load")\r
+               if fields.worldedit_gui_save_load_submit_save then\r
+                       minetest.chatcommands["/save"].func(name, gui_filename[name])\r
+               elseif fields.worldedit_gui_save_load_submit_allocate then\r
+                       minetest.chatcommands["/allocate"].func(name, gui_filename[name])\r
+               else --fields.worldedit_gui_save_load_submit_load\r
+                       minetest.chatcommands["/load"].func(name, gui_filename[name])\r
+               end\r
+               return true\r
+       end\r
+       return false\r
+end)\r
+\r
+worldedit.register_gui_function("worldedit_gui_lua", {\r
+       name = "Run 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_value\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", privs = minetest.chatcommands["/clearobjects"].privs,\r
+       on_select = function(name)\r
+               minetest.chatcommands["/clearobjects"].func(name, "")\r
+       end,\r
+})\r
+\r
 worldedit.register_gui_function("worldedit_gui_formspec_tester", {\r
        name = "Formspec Tester",\r
        get_formspec = function(name)\r
-               local value = gui_formspec[name] or ""\r
+               local value = gui_formspec[name]\r
                return "size[8,6.5]" .. worldedit.get_formspec_header("worldedit_gui_formspec_tester") ..\r
                        string.format("textarea[0.5,1;7.5,5.5;worldedit_gui_formspec_tester_value;Formspec Code;%s]", minetest.formspec_escape(value)) ..\r
                        "button_exit[0,6;3,0.8;worldedit_gui_formspec_tester_show;Show Formspec]"\r
@@ -372,7 +654,4 @@ worldedit.register_gui_handler("worldedit_gui_formspec_tester", function(name, f
                return true\r
        end\r
        return false\r
-end)\r
-\r
---wip: those other commands\r
---wip: Run Lua and Lua Transform
\ No newline at end of file
+end)
\ No newline at end of file