command position added

This commit is contained in:
Joachim Stolberg 2019-01-09 20:57:28 +01:00
parent df9d252f61
commit 031dd0f975

@ -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 local sHELP = [[SaferLua Controller
This controller is used to control and monitor This controller is used to control and monitor
@ -114,6 +118,18 @@ sl_controller.register_function("get_ms_time", {
" returns time with millisecond precision." " 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 function formspec0(meta)
local state = meta:get_int("state") == tubelib.RUNNING local state = meta:get_int("state") == tubelib.RUNNING