lua-users home
lua-l archive

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


On Fri, 30 Aug 2002, Lavergne Thomas wrote:

> Another method is to load your function with load_string and keep a ref 
> on it, so when you need to get it you just need to claim the ref, so no 
> compile needed.

Great! I found loadstring in lua 5.0 is was using 4.0. I think I have to 
upgrade. :-)

But there's a new question. How can I pass arguments to a function I 
created using loadstring?

> You van also keep an other global table with accessible data and 
> function and store it in the lua registry so when your index was call 
> you first check if the user have the right and if you just get the table 
> and retrieve the corresponding data.

Yes, I will definitely start using the registry. With loadstring and the 
registry I don't have to do any hacks, like "return function".

Thanks a lot. I think this is now the proper way.