1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Add formspec table

This commit is contained in:
Kahrl 2013-08-23 12:24:11 +02:00 committed by ShadowNinja
parent 2b1eff7725
commit 8966c16ad2
13 changed files with 1798 additions and 246 deletions

View file

@ -115,26 +115,6 @@ function math.hypot(x, y)
return x * math.sqrt(1 + t * t)
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)
@ -368,6 +348,37 @@ if minetest then
end
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
--------------------------------------------------------------------------------