Improve compatibility with vm1 and C-based lua.
This commit is contained in:
@@ -60,7 +60,7 @@ public class ScriptDrivenTest extends TestCase {
|
||||
default:
|
||||
case JSE:
|
||||
case LUAJIT:
|
||||
_G = org.luaj.vm2.lib.JsePlatform.standardGlobals();
|
||||
_G = org.luaj.vm2.lib.JsePlatform.debugGlobals();
|
||||
break;
|
||||
case JME:
|
||||
_G = org.luaj.vm2.lib.JmePlatform.debugGlobals();
|
||||
@@ -115,7 +115,7 @@ public class ScriptDrivenTest extends TestCase {
|
||||
}
|
||||
default:
|
||||
script = new FileInputStream(file);
|
||||
return LoadState.load(script, "stdin", _G);
|
||||
return LoadState.load(script, "=stdin", _G);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -92,7 +92,7 @@ public class Luajvm1CompatibilityTest extends TestCase {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
PrintStream printStream = new PrintStream( outputStream );
|
||||
try {
|
||||
org.luaj.vm2.LuaTable _G = org.luaj.vm2.lib.JsePlatform.standardGlobals();
|
||||
org.luaj.vm2.LuaTable _G = org.luaj.vm2.lib.JsePlatform.debugGlobals();
|
||||
LuaThread.getRunning().setfenv(_G);
|
||||
_G.get("package").get("loaders").checktable().insert(1, new org.luaj.vm2.lib.OneArgFunction(_G) {
|
||||
public LuaValue call(LuaValue arg) {
|
||||
|
||||
Binary file not shown.
@@ -114,8 +114,8 @@ print( 'get='..tostring(s4)..','..tostring(x4==nil)..','..tostring(y4) )
|
||||
print( 'set='..tostring(s5)..','..tostring(x5==a)..','..tostring(y5) )
|
||||
print( 'get='..tostring(s6)..','..tostring(x6==nil)..','..tostring(y6) )
|
||||
print( pcall( debug.getmetatable, 1 ) )
|
||||
-- print( pcall( debug.setmetatable, 1, {} ) )
|
||||
-- print( pcall( debug.setmetatable, 1, nil ) )
|
||||
print( pcall( debug.setmetatable, 1, {} ) )
|
||||
print( pcall( debug.setmetatable, 1, nil ) )
|
||||
|
||||
print( '----- debug.getinfo' )
|
||||
local printfield = function(tbl, field)
|
||||
@@ -126,10 +126,6 @@ local printfield = function(tbl, field)
|
||||
x = '{'..table.concat(x,',')..'}'
|
||||
elseif typ=='function' then
|
||||
x = typ
|
||||
elseif typ=='string' then
|
||||
if field == 'source' then
|
||||
x = x:sub(2)
|
||||
end
|
||||
end
|
||||
print( ' '..field..': '..tostring(x) )
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user