aboutsummaryrefslogtreecommitdiff
path: root/builtin/misc_helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/misc_helpers.lua')
-rw-r--r--builtin/misc_helpers.lua51
1 files changed, 31 insertions, 20 deletions
diff --git a/builtin/misc_helpers.lua b/builtin/misc_helpers.lua
index 097c65865..a7a8f6b1c 100644
--- a/builtin/misc_helpers.lua
+++ b/builtin/misc_helpers.lua
@@ -116,26 +116,6 @@ function math.hypot(x, y)
end
--------------------------------------------------------------------------------
-function explode_textlist_event(text)
-
- local retval = {}
- retval.typ = "INV"
-
- local parts = text:split(":")
-
- if #parts == 2 then
- retval.typ = parts[1]:trim()
- retval.index= tonumber(parts[2]:trim())
-
- if type(retval.index) ~= "number" then
- retval.typ = "INV"
- end
- end
-
- return retval
-end
-
---------------------------------------------------------------------------------
function get_last_folder(text,count)
local parts = text:split(DIR_DELIM)
@@ -369,6 +349,37 @@ if minetest then
end
--------------------------------------------------------------------------------
+function tbl.explode_table_event(evt)
+ if evt ~= nil then
+ local parts = evt:split(":")
+ if #parts == 3 then
+ local t = parts[1]:trim()
+ local r = tonumber(parts[2]:trim())
+ local c = tonumber(parts[3]:trim())
+ if type(r) == "number" and type(c) == "number" and t ~= "INV" then
+ return {type=t, row=r, column=c}
+ end
+ end
+ end
+ return {type="INV", row=0, column=0}
+end
+
+--------------------------------------------------------------------------------
+function tbl.explode_textlist_event(evt)
+ if evt ~= nil then
+ local parts = evt:split(":")
+ if #parts == 2 then
+ local t = parts[1]:trim()
+ local r = tonumber(parts[2]:trim())
+ if type(r) == "number" and t ~= "INV" then
+ return {type=t, index=r}
+ end
+ end
+ end
+ return {type="INV", index=0}
+end
+
+--------------------------------------------------------------------------------
-- mainmenu only functions
--------------------------------------------------------------------------------
if engine ~= nil then