mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add bam 0.5.0 support while retaining 0.4.0 compatiblity
This commit is contained in:
parent
3341e18d13
commit
64ca2cfde9
1
bam.lua
1
bam.lua
|
@ -1,4 +1,3 @@
|
|||
CheckVersion("0.4")
|
||||
|
||||
target_family = os.getenv("TARGET_FAMILY")
|
||||
if target_family then
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
|
||||
function loadfile_(filename, env)
|
||||
local file
|
||||
if _VERSION == "Lua 5.1" then
|
||||
file = loadfile(filename)
|
||||
setfenv(file, env)
|
||||
else
|
||||
file = loadfile(filename, nil, env)
|
||||
end
|
||||
return file
|
||||
end
|
||||
|
||||
--[[@GROUP Configuration@END]]--
|
||||
|
||||
--[[@FUNCTION
|
||||
|
@ -72,13 +83,13 @@ function NewConfig(on_configured_callback)
|
|||
end
|
||||
|
||||
config.Load = function(self, filename)
|
||||
local options_func = loadfile(filename)
|
||||
local options_table = {}
|
||||
local options_func = loadfile_(filename, options_table)
|
||||
|
||||
if not options_func then
|
||||
print("auto configuration")
|
||||
self:Config(filename)
|
||||
options_func = loadfile(filename)
|
||||
options_func = loadfile_(filename, options_table)
|
||||
end
|
||||
|
||||
if options_func then
|
||||
|
@ -86,7 +97,6 @@ function NewConfig(on_configured_callback)
|
|||
for k,v in pairs(self.options) do
|
||||
options_table[v.name] = {}
|
||||
end
|
||||
setfenv(options_func, options_table)
|
||||
|
||||
-- this is to make sure that we get nice error messages when
|
||||
-- someone sets an option that isn't valid.
|
||||
|
|
Loading…
Reference in a new issue