[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Basics: modules()?
- From: Tim Gogolin <tgogolin@...>
- Date: Mon, 12 Sep 2005 14:39:23 -0500
local variables can be accessed more efficiently at runtime than
named identifier lookups. Locals are found at runtime as an array
access (by index), whereas table lookups are a hash table lookup. So
this is probably just an attempt to make frequently used function
calls execute a little faster.
-- Tim Gogolin
On Sep 12, 2005, at 2:23 PM, William Trenker wrote:
From studying various Lua modules I see that experienced Lua
programmers usually set up a number of local variables that carry the
value of standard library functions, like this:
local assert, error, _G, loadstring, loadfile, _pcall, type, unpack,
xpcall = assert, error, _G, loadstring, loadfile, pcall, type, unpack,
What is the point of this? On the surface it appears to be redundant.
But since it is often used by the experts I'm obviously missing
Thanks very much,