Improve debug lib consistency with lua 5.2
This commit is contained in:
@@ -63,10 +63,10 @@ public class ScriptDrivenTest extends TestCase implements ResourceFinder {
|
||||
default:
|
||||
case JSE:
|
||||
case LUAJIT:
|
||||
globals = org.luaj.vm2.lib.jse.JsePlatform.standardGlobals();
|
||||
globals = org.luaj.vm2.lib.jse.JsePlatform.debugGlobals();
|
||||
break;
|
||||
case JME:
|
||||
globals = org.luaj.vm2.lib.jme.JmePlatform.standardGlobals();
|
||||
globals = org.luaj.vm2.lib.jme.JmePlatform.debugGlobals();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -179,8 +179,6 @@ public class ScriptDrivenTest extends TestCase implements ResourceFinder {
|
||||
if ( script == null )
|
||||
fail("Could not load script for test case: " + name);
|
||||
try {
|
||||
// Use "stdin" instead of resource name so that output matches
|
||||
// standard Lua.
|
||||
switch ( this.platform ) {
|
||||
case LUAJIT:
|
||||
if ( nocompile ) {
|
||||
@@ -190,7 +188,7 @@ public class ScriptDrivenTest extends TestCase implements ResourceFinder {
|
||||
return LuaJC.getInstance().load( script, name, _G);
|
||||
}
|
||||
default:
|
||||
return LoadState.load(script, "=stdin", "bt", _G);
|
||||
return LoadState.load(script, "@"+name+".lua", "bt", _G);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -80,6 +80,7 @@ local echo = function(msg,...)
|
||||
return ...
|
||||
end
|
||||
local echocr = function(...)
|
||||
local arg = table.pack(...)
|
||||
echo('(echocr) first args', table.unpack(arg,1,arg.n))
|
||||
local a = arg
|
||||
while true do
|
||||
|
||||
@@ -85,11 +85,11 @@ print( 'a.a='..tostring(a.a)..' a.b='..tostring(a.b)..' b.a='..tostring(b.a)..'
|
||||
local s1,x1,y1 = pcall( debug.getmetatable, a )
|
||||
local s2,x2,y2 = pcall( debug.setmetatable, a, mt )
|
||||
print( 'a.a='..tostring(a.a)..' a.b='..tostring(a.b)..' b.a='..tostring(b.a)..' b.b='..tostring(b.b))
|
||||
local s3,x3,y3 = pcall( debug.getmetatable, a )
|
||||
local s4,x4,y4 = pcall( debug.getmetatable, b )
|
||||
local s5,x5,y5 = pcall( debug.setmetatable, a, nil )
|
||||
local s3,x3,y3 = pcall( debug.getmetatable, a ) print(type(s3), type(x3), type(y3), type(getmetatable(a)))
|
||||
local s4,x4,y4 = pcall( debug.getmetatable, b ) print(type(s4), type(x4), type(y4), type(getmetatable(b)))
|
||||
local s5,x5,y5 = pcall( debug.setmetatable, a, nil ) print(type(s5), type(x5), type(y5), type(getmetatable(a)))
|
||||
print( 'a.a='..tostring(a.a)..' a.b='..tostring(a.b)..' b.a='..tostring(b.a)..' b.b='..tostring(b.b))
|
||||
local s6,x6,y6 = pcall( debug.getmetatable, a )
|
||||
local s6,x6,y6 = pcall( debug.getmetatable, a ) print(type(s6), type(x6), type(y6), type(getmetatable(a)))
|
||||
if not s1 then print( 's1 error', x1 ) end
|
||||
if not s2 then print( 's2 error', x2 ) end
|
||||
if not s3 then print( 's3 error', x3 ) end
|
||||
|
||||
Reference in New Issue
Block a user