diff --git a/sl_controller/controller.lua b/sl_controller/controller.lua index f25f227..5650dee 100644 --- a/sl_controller/controller.lua +++ b/sl_controller/controller.lua @@ -12,6 +12,10 @@ ]]-- +-- for lazy programmers +local S = function(pos) if pos then return minetest.pos_to_string(pos) end end +local M = minetest.get_meta + local sHELP = [[SaferLua Controller This controller is used to control and monitor @@ -114,6 +118,18 @@ sl_controller.register_function("get_ms_time", { " returns time with millisecond precision." }) +sl_controller.register_function("position", { + cmnd = function(self, number) + local info = tubelib.get_node_info(number) + if info then + return S(info.pos) + end + return "(-,-,-)" + end, + help = "$position(number)\n".. + " returns the position '(x,y,z)' of the device\n with given number." +}) + local function formspec0(meta) local state = meta:get_int("state") == tubelib.RUNNING