2 ms·
`.` and `\` in Moonscript map to `.` and `:` in Lua. In Lua, `foo.bar` is just syntactic sugar for `foo["bar"]`, a table lookup with a string key. In turn, `f
by pygy_ 14y ago
`.` and `\` in Moonscript map to `.` and `:` in Lua.
In Lua, `foo.bar` is just syntactic sugar for `foo["bar"]`, a table lookup with a string key.
In turn, `foo:bar(baz)` is syntactic sugar for `foo.bar(foo, baz)`.
It is not uncommon to mix things up, and put a dot instead of the column. IIRC, Leafo used the backslash instead because it is more distinct, visually.
Users\create name: @params.username
is thus equivalent to
Users.create( Users, name: @params.username )
(adding parens for maximum clarity).