1
0
Fork 0
mirror of https://github.com/Reuh/candran.git synced 2025-10-27 17:59:30 +00:00

On second though, string and table calls are a bad idea

This commit is contained in:
Étienne Fildadut 2018-08-30 18:31:06 +02:00
parent 98a6a87962
commit 67f681a88a
3 changed files with 19 additions and 18 deletions

View file

@ -257,7 +257,6 @@ _Not in the latest release, install the `candran-scm-1.rockspec` version if you
```lua
"some text":upper() -- same as ("some text"):upper() in Lua
"string".upper -- the actual string.upper function. "string"["upper"] also works.
-- Also works with calls, for example "string"(), but it isn't really useful for strings.
{thing = 3}.thing -- 3. Also works with tables!
[for i=0,5 do i*i end][3] -- 9. And table comprehensions!
@ -266,7 +265,7 @@ _Not in the latest release, install the `candran-scm-1.rockspec` version if you
someFunction"thing":upper() -- same as (someFunction("thing")):upper() (i.e., the way it would be parsed by Lua)
```
String litterals, table litterals, and comprehensions can be suffixed with `:` method calls, `.` or `[` indexing, or `(` functions calls, without needing to be enclosed in parantheses.
String litterals, table litterals, and comprehensions can be suffixed with `:` method calls, `.` indexing, or `[` indexing, without needing to be enclosed in parantheses.
*Please note*, that "normal" functions calls have priority over this syntax, in order to maintain Lua compatibility.