lua-users home
lua-l archive

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


On Jul 1, 2010, at 9:25 PM, Luiz Henrique de Figueiredo wrote:

> Lua is probably quite fast already even if you only use
> global variables, ie, don't bother with locals.

FWIW, in modules, I use locals as an import mechanism, irrespectively of "performance" consideration.

E.g.:

-- import dependencies
local table = require( 'table' )

local assert = assert
local getmetatable = getmetatable

module( 'DB' )

-- no access to globals from that point on

For example:

http://dev.alt.textdrive.com/browser/HTTP/DB.lua