lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm new to lua, so I've got a couple of questions.

I'll try to explain everything in details so that you
can understand my questions.

here are my questions:
1- how to remove a value from the globals table
I had a C pointer, and I wanted to export it(make it
available) to lua, so I deduced(from the docs) that
this is possible by adding this pointer to the globals
table, I did this like this:

lua_pushstring(luaState, var_name);
lua_pushlightuserdata(luaState, value);
lua_settable(luaState, LUA_GLOBALSINDEX);

so, now I want to know how to remove this variable so
that it's not available to lua code anymore.

2- how to un-register a function
I've registered a function using the macro
lua_register

how to un-register the function so that it can't be
called from lua anymore.

3-how to remove all the variable associated with a
chunk(i.e. unload the chunk and all associated data
and functions).
I loaded a chunk using luaL_loadfile(), and everything
went fine.
I reached a point in the program where I don't want
that loaded chunk, I want to discard it and all the
associated data, how to do this?

4- how to make global variables read-only?
I heard it is possible to make variables read-only in
lua, how can I do this?

5- how to get a table's length?

thanks for you effort.


		
__________________________________ 
Yahoo! Mail for Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail