lua-users home
lua-l archive

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

Sure, it just looks a bit ugly when you have Lua based DSL and only such a
tables and still have to declare all of them like that. Global single
character function not the most beautiful thing.

Sam Putman wrote
> On Sun, Feb 16, 2020 at 4:52 PM Pavel <

> temp213@

> > wrote:
> `t()` is one more character than `{}` and could be defined like so:
> local function t(tab) -- can be global in a long/complex program
>    tab = tab or {}
>    return setmetatable({}, table)
> end
> and you could call it with `t{}` to remind yourself what it does.
> This is what I'd do if I were planning to use such tables frequently.
> cheers,
> -Sam.

Sent from: