diff options
author | Mike Pall <mike> | 2012-02-17 11:40:18 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2012-02-17 11:40:18 +0100 |
commit | 6c05739684527919293e25668589f17c35a7c129 (patch) | |
tree | c77442560161b0b512533b84f865c1fee18bff48 /dynasm/dynasm.lua | |
parent | ff7139493196f8b43bc8912a9ea33d4d5e169796 (diff) | |
download | luajit-6c05739684527919293e25668589f17c35a7c129.tar.gz luajit-6c05739684527919293e25668589f17c35a7c129.tar.bz2 luajit-6c05739684527919293e25668589f17c35a7c129.zip |
DynASM: Lua 5.2 compatibility fixes.
Diffstat (limited to '')
-rw-r--r-- | dynasm/dynasm.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/dynasm/dynasm.lua b/dynasm/dynasm.lua index b89d6cfc..2ef81647 100644 --- a/dynasm/dynasm.lua +++ b/dynasm/dynasm.lua | |||
@@ -259,9 +259,17 @@ local condstack = {} | |||
259 | 259 | ||
260 | -- Evaluate condition with a Lua expression. Substitutions already performed. | 260 | -- Evaluate condition with a Lua expression. Substitutions already performed. |
261 | local function cond_eval(cond) | 261 | local function cond_eval(cond) |
262 | local func, err = loadstring("return "..cond) | 262 | local func, err |
263 | if setfenv then | ||
264 | func, err = loadstring("return "..cond, "=expr") | ||
265 | else | ||
266 | -- No globals. All unknown identifiers evaluate to nil. | ||
267 | func, err = load("return "..cond, "=expr", "t", {}) | ||
268 | end | ||
263 | if func then | 269 | if func then |
264 | setfenv(func, {}) -- No globals. All unknown identifiers evaluate to nil. | 270 | if setfenv then |
271 | setfenv(func, {}) -- No globals. All unknown identifiers evaluate to nil. | ||
272 | end | ||
265 | local ok, res = pcall(func) | 273 | local ok, res = pcall(func) |
266 | if ok then | 274 | if ok then |
267 | if res == 0 then return false end -- Oh well. | 275 | if res == 0 then return false end -- Oh well. |