Remove defunct Lua version compat

This commit is contained in:
Lars Mueller 2022-10-03 18:23:30 +02:00
parent b19d4febb2
commit ea534909c7
2 changed files with 1 additions and 38 deletions

@ -4,7 +4,7 @@ Multipurpose Minetest Modding Library
## About ## About
No dependencies. Licensed under the MIT License. Written by Lars Mueller aka LMD or appguru(eu). Notable contributions by [luk3yx](https://github.com/luk3yx) in the form of suggestions, bug reports and fixes. Another [bugfix](https://github.com/appgurueu/modlib/pull/7) by [NobWow](https://github.com/NobWow/). No dependencies. Licensed under the MIT License. Written by Lars Mueller aka LMD or appguru(eu). Notable contributions by [luk3yx](https://github.com/luk3yx) in the form of suggestions, bug reports and fixes. Another [bugfix](https://github.com/appgurueu/modlib/pull/7) by [NobWow](https://github.com/NobWow/). Requires Lua 5.1 / LuaJIT.
### Principles ### Principles

@ -1,40 +1,3 @@
-- Lua version check
if _VERSION then
-- TODO get rid of this string version checking
if _VERSION < "Lua 5" then
error("Outdated Lua version! modlib requires Lua 5 or greater.")
end
if _VERSION > "Lua 5.1" then
-- not throwing error("Too new Lua version! modlib requires Lua 5.1 or smaller.") anymore
unpack = unpack or table.unpack -- unpack was moved to table.unpack in Lua 5.2
loadstring = loadstring or load
setfenv = setfenv or function(fn, env)
local i = 1
while true do
local name = debug.getupvalue(fn, i)
if name == "_ENV" then
debug.setupvalue(fn, i, env)
break
elseif not name then
break
end
end
return fn
end
getfenv = getfenv or function(fn)
local i = 1
local name, val
repeat
name, val = debug.getupvalue(fn, i)
if name == "_ENV" then
return val
end
i = i + 1
until not name
end
end
end
local modules = {} local modules = {}
for _, file in pairs{ for _, file in pairs{
"schema", "schema",