mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-23 23:53:44 +01:00
db7b20d485
Also, you can return a value from dofile()!!!! This changes everything.
15 lines
436 B
Lua
15 lines
436 B
Lua
--- Polyfill for unpack / table.unpack.
|
|
-- Calls unpack when available, and looks for table.unpack if unpack() isn't
|
|
-- found.
|
|
-- This is needed because in Lua 5.1 it's the global unpack(), but in Lua 5.4
|
|
-- it's moved to table.unpack().
|
|
local function table_unpack(tbl, offset, count)
|
|
if type(unpack) == "function" then
|
|
return unpack(tbl, offset, count)
|
|
else
|
|
return table.unpack(tbl, offset, count)
|
|
end
|
|
end
|
|
|
|
return table_unpack
|