diff options
author | 2012-10-30 13:34:53 -0400 | |
---|---|---|
committer | 2012-10-30 13:34:53 -0400 | |
commit | 8020ef7e08d812ac28d5c5ff12d311d1ee3b39a6 (patch) | |
tree | 284216acd1299ef552b6e34e7fd8774240c034c0 /core/compat.lua | |
parent | a8b2b4e85ab241e20ce8f55d4c871a8653d435f7 (diff) | |
download | textadept-8020ef7e08d812ac28d5c5ff12d311d1ee3b39a6.tar.gz textadept-8020ef7e08d812ac28d5c5ff12d311d1ee3b39a6.zip |
Updated to LuaJIT 2.0.0-beta11; core/compat.lua
Diffstat (limited to 'core/compat.lua')
-rw-r--r-- | core/compat.lua | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/core/compat.lua b/core/compat.lua index 0f490748..71541b02 100644 --- a/core/compat.lua +++ b/core/compat.lua @@ -3,52 +3,11 @@ -- When using LuaJIT try to retain backwards compatibility (Lua 5.1). -- LuaJIT is compiled with LUAJIT_ENABLE_LUA52COMPAT for some Lua 5.2 features. --- In Lua 5.1, `load` did not take mode and environment parameters. -local load51 = load -function load(ld, source, mode, env) - local f, err = load51(ld, source) - if f and env then return setfenv(f, env) end - return f, err -end - --- In Lua 5.1, `loadfile` did not take mode and environment parameters. -local loadfile51 = loadfile -function loadfile(filename, mode, env) - local f, err = loadfile51(filename) - if f and env then return setfenv(f, env) end - return f, err -end - --- In Lua 5.1, `xpcall` did not accept function arguments. -local xpcall51 = xpcall -function xpcall(f, error, ...) - local args = {...} - return xpcall51(function() return f(unpack(args)) end, error) -end - -- In Lua 5.1, `module` exists. _G.module = nil -- use _G prefix so LuaDoc does not get confused -- In Lua 5.1, `package.loaders` is `package.searchers` package.searchers = package.loaders --- TODO: table.pack --- In Lua 5.1, `table.pack` did not exist. - --- TODO: string.rep --- In Lua 5.1, `string.rep` did not take separation string parameter. - --- TODO: math.log, math.log10 --- In Lua 5.1, `math.log` does not take base parameter and `math.log10` existed. - -- In LuaJIT, `bit` is used instead of `bit32` bit32 = bit - --- In Lua 5.1, `os.execute` returned an integer depending on shell availability. --- It also returned just a status code. -local os_execute51 = os.execute -function os.execute(command) - if not command then return os_execute51() ~= 0 end - local code = os_execute51(command) - return code == 0, 'exit', code -end |