lua-users home
lua-l archive

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

On Sunday, November 17, 2013, Paul K wrote:
> I'd only say that the crazy amount of "a, b, c = a, b, c" is rather hard to explain as a "sweet feature of Lua"

I don't mind writing local a,b,c = tbl.a, tbl.b, tbl.c, but what I
sometimes want is to be able to say:

local insert, remove, concat alias table

This would assign insert, remove, and concat from "table" with a small
twist: when table.insert changes, that change is propagated to the
local variable "insert". I'm less certain how this should work when
the entire table "table" changes, but for this to work in "require,
unrequire, require" scenario (which is what I'd want), this would need
to work when a new table is assigned as well.

The primary use for me would be to be able to re-load modules with the
changes "seen" in their dependent modules (even when localized if
using this "alias" mechanism), but there may be other use cases.

Maybe that's an overkill, and what I really want is something like this:

local mymodule = proxy(require("mymodule"))

with "proxy" doing some magic that changes "mymodule" variable when
the table returned by "require" changes (similar to what described


On Sun, Nov 17, 2013 at 8:48 AM, Andrew Starks <> wrote:

Sorry man. I can't think of anything worse than a world where...

local c = concat


assert(c == concat)

...could ever fail. You've broken consistency without even giving me parallisn.