mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Remove defunct Lua version compat
This commit is contained in:
parent
b19d4febb2
commit
ea534909c7
@ -4,7 +4,7 @@ Multipurpose Minetest Modding Library
|
||||
|
||||
## 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
|
||||
|
||||
|
37
init.lua
37
init.lua
@ -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 = {}
|
||||
for _, file in pairs{
|
||||
"schema",
|
||||
|
Loading…
Reference in New Issue
Block a user