From ea534909c7072ef9d5c9c4285cf536ddc8995995 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Mon, 3 Oct 2022 18:23:30 +0200 Subject: [PATCH] Remove defunct Lua version compat --- Readme.md | 2 +- init.lua | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/Readme.md b/Readme.md index 440815a..e761511 100644 --- a/Readme.md +++ b/Readme.md @@ -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 diff --git a/init.lua b/init.lua index e1f11df..acca782 100644 --- a/init.lua +++ b/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",