2 ms·
Lua does too, for literal tables and strings being sole argument you can omit parentheses. But to call method on a literal you need to add them. > print("OK")
by FRex 9y ago
Lua does too, for literal tables and strings being sole argument you can omit parentheses. But to call method on a literal you need to add them.
> print("OK")
> print "OK"
> ("OK %d"):format(1)
I've seen some funky (ab)use of these, people using literal strings and tables and functions named class and similar to do:
> class "Something" {
> -- ...
> }
- jmaa 9y agoThis is one of the reasons I love Lua. I'm constantly pleasantly surprised by Lua. It defines a few simple primitives, and allows you to do whatever you want with them, even to the absurd. Hell, it even allows you to do this: > somefunc "1string" "2string" "3string" > somefunc {} {} {}