[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Performance Question
- From: "Raymond Jacobs" <raymondj@...>
- Date: Thu, 8 Jan 2009 14:59:47 -0500
Thanks for the clarification :)
Any thoughts on the boxing and unboxing of 10,000 elements (say 32 bytes each) into a lua table, and processing them with a lua function?
On Thu, Jan 8, 2009 at 2:51 PM, Sam Roberts <firstname.lastname@example.org>
No. loadstring just returns a function that is the compiled code you
On Thu, Jan 8, 2009 at 11:23 AM, Raymond Jacobs <email@example.com
> Yeah i am using it for various scripts, so probably not.
> Now, what if this script includes functions; I imagine those are added to
> the registry when loadstring is called?
loaded. Call it "F".
> it is possible that subsequent loadings could overwrite them; i assume just
> calling the function returned from loadstring wont restore them?
The functions defined F are created when you run F, not when you
compile F, each time (overwriting any previous definitions).
Well written code would probably not create global functions, it would
use local a lot.
Or to avoid the script writer having to think about this, the use
lua_setfenv() on F to provide it with a "global" table, so it doesn't
pollute the global namespace, and the writer doesn't have to consider
the distinction between local and global.