summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheinrich5991 <heinrich5991@gmail.com>2016-08-03 00:01:50 +0200
committerheinrich5991 <heinrich5991@gmail.com>2018-10-12 22:09:04 +0200
commit1bb680a49b256b9641baed44ef8a8c5a485285ba (patch)
treec15095c320d9b8c4432db976e01877eda1497066
parentaea78ef68ee416a2e6e72da24e8a9eb6b0039e9c (diff)
Add bam 0.5.0 support while retaining 0.4.0 compatiblity
(cherry picked from commit 64ca2cfde9dc4857e338c3953cfee1138f3c4fb2)
-rw-r--r--bam.lua1
-rw-r--r--configure.lua16
2 files changed, 13 insertions, 4 deletions
diff --git a/bam.lua b/bam.lua
index 3ac85f3f7..a4babf407 100644
--- a/bam.lua
+++ b/bam.lua
@@ -1,4 +1,3 @@
-CheckVersion("0.4")
Import("configure.lua")
Import("other/sdl/sdl.lua")
diff --git a/configure.lua b/configure.lua
index 2db70cc4d..19cd6ab29 100644
--- a/configure.lua
+++ b/configure.lua
@@ -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.