Fix message when disallowing plain setmetatable for non-tables.

This commit is contained in:
James Roseborough
2015-04-11 23:07:08 +00:00
parent 977353080c
commit b16c521f40

View File

@@ -323,7 +323,7 @@ public class BaseLib extends TwoArgFunction implements ResourceFinder {
return argerror(2,"value");
}
public LuaValue call(LuaValue table, LuaValue metatable) {
final LuaValue mt0 = table.getmetatable();
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());