4 ms·
In case you’re wondering what Lua does in this case, it has a special syntax iff the sole argument is a “table” (core dict/array mix) or a string: f {1, 2, a
by wruza 3y ago
In case you’re wondering what Lua does in this case, it has a special syntax iff the sole argument is a “table” (core dict/array mix) or a string:
f {1, 2, a=3}
is equivalent to
f({1, 2, a=3})
A function f(t) receives an argument t in both cases. This makes a good use for DSLs by reducing ()-noise.
It doesn’t have **kwargs in pythonic form, although it has varargs syntax. But all parameters are strictly positional and don’t self-pack or self-unpack in any way.
So this inspiration is pretty far from what happens there.
- kzrdude 3y agoAnd calling without ()'s is also available if you call with a single string literal, as often seen in require "modulename".