vm/src/lib.js
function (table, metatable) {
			var mt;

			if (!((table || shine.EMPTY_OBJ) instanceof shine.Table)) throw new shine.Error('Bad argument #1 in setmetatable(). Table expected');	
			if (!(metatable === undefined || (metatable || shine.EMPTY_OBJ) instanceof shine.Table)) throw new shine.Error('Bad argument #2 in setmetatable(). Nil or table expected');	
			if ((mt = table.__shine.metatable) && (mt = mt.__metatable)) throw new shine.Error('cannot change a protected metatable');

			shine.gc.incrRef(metatable);
			shine.gc.decrRef(table.__shine.metatable);

			table.__shine.metatable = metatable;

			return table;
		}
function (table, metatable) {
			var mt;

			if (!((table || shine.EMPTY_OBJ) instanceof shine.Table)) throw new shine.Error('Bad argument #1 in setmetatable(). Table expected');	
			if (!(metatable === undefined || (metatable || shine.EMPTY_OBJ) instanceof shine.Table)) throw new shine.Error('Bad argument #2 in setmetatable(). Nil or table expected');	
			if ((mt = table.__shine.metatable) && (mt = mt.__metatable)) throw new shine.Error('cannot change a protected metatable');

			shine.gc.incrRef(metatable);
			shine.gc.decrRef(table.__shine.metatable);

			table.__shine.metatable = metatable;

			return table;
		}
function ( table , metatable ) { var mt ; if ( ! ( ( table || shine . EMPTY_OBJ ) instanceof shine . Table ) ) throw new shine . Error ( 'Bad argument #1 in setmetatable(). Table expected' ) ; if ( ! ( metatable === undefined || ( metatable || shine . EMPTY_OBJ ) instanceof shine . Table ) ) throw new shine . Error ( 'Bad argument #2 in setmetatable(). Nil or table expected' ) ; if ( ( mt = table . __shine . metatable ) && ( mt = mt . __metatable ) ) throw new shine . Error ( 'cannot change a protected metatable' ) ; shine . gc . incrRef ( metatable ) ; shine . gc . decrRef ( table . __shine . metatable ) ; table . __shine . metatable = metatable ; return table ; }
Implementation of Lua's setmetatable function.
@param {object} table The table that will receive the metatable.
@param {object} metatable The metatable to attach.
Implementation of Lua s setmetatable function .