BaseLib: fix handling of __tostring
This commit is contained in:
@@ -350,8 +350,11 @@ public class BaseLib extends TwoArgFunction implements ResourceFinder {
|
|||||||
static final class tostring extends LibFunction {
|
static final class tostring extends LibFunction {
|
||||||
public LuaValue call(LuaValue arg) {
|
public LuaValue call(LuaValue arg) {
|
||||||
LuaValue h = arg.metatag(TOSTRING);
|
LuaValue h = arg.metatag(TOSTRING);
|
||||||
if ( ! h.isnil() )
|
if ( ! h.isnil() ) {
|
||||||
return h.call(arg);
|
LuaValue v = h.call(arg);
|
||||||
|
LuaValue vs = v.tostring();
|
||||||
|
return !vs.isnil() ? vs : v;
|
||||||
|
}
|
||||||
LuaValue v = arg.tostring();
|
LuaValue v = arg.tostring();
|
||||||
if ( ! v.isnil() )
|
if ( ! v.isnil() )
|
||||||
return v;
|
return v;
|
||||||
|
|||||||
Reference in New Issue
Block a user