Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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" {

> -- ...

> }



This 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 {} {} {}




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: