public LuaValue call(LuaValue value, LuaValue table) { LuaValue mt = table.opttable(null); switch ( value.type() ) { case TNIL: LuaNil.s_metatable = mt; break; case TNUMBER: LuaNumber.s_metatable = mt; break; case TBOOLEAN: LuaBoolean.s_metatable = mt; break; case TSTRING: LuaString.s_metatable = mt; break; case TFUNCTION: LuaFunction.s_metatable = mt; break; case TTHREAD: LuaThread.s_metatable = mt; break; default: value.setmetatable( mt ); } return value; } }
public LuaValue call(LuaValue value, LuaValue table) { LuaValue mt = table.opttable(null); switch ( value.type() ) { case TNIL: LuaNil.s_metatable = mt; break; case TNUMBER: LuaNumber.s_metatable = mt; break; case TBOOLEAN: LuaBoolean.s_metatable = mt; break; case TSTRING: LuaString.s_metatable = mt; break; case TFUNCTION: LuaFunction.s_metatable = mt; break; case TTHREAD: LuaThread.s_metatable = mt; break; default: value.setmetatable( mt ); } return value; } }
@Override public LuaValue call(LuaValue value, LuaValue table) { LuaValue mt = table.opttable(null); switch ( value.type() ) { case TNIL: LuaNil.s_metatable = mt; break; case TNUMBER: LuaNumber.s_metatable = mt; break; case TBOOLEAN: LuaBoolean.s_metatable = mt; break; case TSTRING: LuaString.s_metatable = mt; break; case TFUNCTION: LuaFunction.s_metatable = mt; break; case TTHREAD: LuaThread.s_metatable = mt; break; default: value.setmetatable( mt ); } return value; } }
@Override public LuaValue call(LuaValue table, LuaValue metatable) { final LuaValue mt0 = table.getmetatable(); if ( mt0!=null && !mt0.rawget(METATABLE).isnil() ) error("cannot change a protected metatable"); return table.setmetatable(metatable.isnil()? null: metatable.checktable()); } }
public LuaValue call(LuaValue table, LuaValue metatable) { final LuaValue mt0 = table.checktable().getmetatable(); if (mt0 != null && !mt0.rawget(METATABLE).isnil()) { error("cannot change a protected metatable"); } return table.setmetatable(metatable.isnil() ? null : metatable.checktable()); } }
public LuaValue call(LuaValue table, LuaValue metatable) { final LuaValue mt0 = table.checktable().getmetatable(); if ( mt0!=null && !mt0.rawget(METATABLE).isnil() ) error("cannot change a protected metatable"); return table.setmetatable(metatable.isnil()? null: metatable.checktable()); } }