[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: local by default?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 29 Apr 2002 17:12:24 -0300
> Just out of curiosity, there is a good reason to create two classes of
> variables?
Performance.
> Why not having a locals table for each function and create
> them at run time?
Lua local variables are ~3 times faster than global (table field)
variables, without counting the time to create/collect those tables.
Moreover, the "unit" of scope in Lua is a block, not a function (so you
would need several tables for each function...)
-- Roberto