diff options
author | Kahrl <kahrl@gmx.net> | 2013-08-23 12:24:11 +0200 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-01-13 18:11:08 -0500 |
commit | 8966c16ad298f94be1f4542afa6b081a1d286eda (patch) | |
tree | 00e50224528a7f0bbb46cb05d81177f5e8086c41 /builtin/misc_helpers.lua | |
parent | 2b1eff772524fca8249fd64028e5cbfeabc127a0 (diff) | |
download | minetest-8966c16ad298f94be1f4542afa6b081a1d286eda.tar.gz minetest-8966c16ad298f94be1f4542afa6b081a1d286eda.tar.bz2 minetest-8966c16ad298f94be1f4542afa6b081a1d286eda.zip |
Add formspec table
Diffstat (limited to 'builtin/misc_helpers.lua')
-rw-r--r-- | builtin/misc_helpers.lua | 51 |
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 |