Lua code can never change the metatable of a userdata anyway
(setmetatable is possible only for a table).
getmetatable is now allowed for tasks and hosts: it's harmless and lets
people extend them.
// writing doesn't work
lua_setfield(L, -2, "__index");
/* simgrid.task mt */
// writing doesn't work
lua_setfield(L, -2, "__index");
/* simgrid.task mt */
- lua_pushliteral(L, "__metatable");
- /* simgrid.task mt "__metatable" */
- lua_pushnumber(L, 0);
- /* simgrid.task mt "__metatable" 0 */
- /* protect the metatable from Lua code (by setting any value to __metatable) */
- lua_rawset(L, -3); /* simgrid.task mt */
lua_pop(L, 2);
/* -- */
}
lua_pop(L, 2);
/* -- */
}
// FIXME: cannot work currently, same problem as tasks
lua_setfield(L, -2, "__index");
/* simgrid.host mt */
// FIXME: cannot work currently, same problem as tasks
lua_setfield(L, -2, "__index");
/* simgrid.host mt */
- lua_pushliteral(L, "__metatable");
- /* simgrid.host mt "__metatable" */
- lua_pushnumber(L, 0);
- /* simgrid.host mt "__metatable" 0 */
- /* protect the metatable from Lua code (by setting any value to __metatable) */
- lua_rawset(L, -3); /* simgrid.host mt */
lua_pop(L, 2);
/* -- */
}
lua_pop(L, 2);
/* -- */
}