lua-users home
lua-l archive

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

On Thu, Apr 3, 2008 at 9:00 PM, Fabien <> wrote:
Notice that metalint can easily be turned into a smarter variable localizer, which would change references to module elements into local variables. For instance, it would add "local _table_insert = table.insert" at the beginning of the file, and change every instance of "table.insert" into a reference to the local variable. This would be much more efficient than simply adding a "local table=table".

This has been done and is available as It will turn this:

local x = { }
-- This module declares table 'Corge', 
-- and advertises it in its .dlua interface file:
require 'corge'
table.insert(x, 'foo')

into the equivalent of this:

local _table_insert = table.insert
local x = { }
require 'corge' 
local _Corge_foo =
_table_insert(x, 'foo')