[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to undefine a function?
- From: Peter Shook <pshook@...>
- Date: Sun, 10 Aug 2003 00:28:50 -0400
Gyorgy Bozoki wrote:
Is there a way to learn what functions are defined when I call lua_dofile() /
lua_dostring()? And using this information, is there a way to programmatically
undefine these functions?
Here is an example to help you get started.
lua_newtable(L); /* new stuff */
lua_newtable(L); /* metatable */
lua_pushliteral(L, "__index");
lua_pushvalue(L, -3);
lua_settable(L, -3);
lua_pushliteral(L, "__newindex");
lua_pushvalue(L, -3);
lua_settable(L, -3);
lua_setmetatable(L, LUA_GLOBALSINDEX);
lua_setglobal(L, "newstuff");
lua_dofile(L, "x.lua");
lua_pushnil(L);
lua_setmetatable(L, LUA_GLOBALSINDEX);
- Peter