5 ms·
Lua conditional expressions look like this: x > 0 and x or -x It says none in the reference, which is wrong, so I'm posting it here in hopes the author mi
by rweichler 10y ago
Lua conditional expressions look like this:
x > 0 and x or -x
It says none in the reference, which is wrong, so I'm posting it here in hopes the author might fix it.
Edit:
Found a bunch more things they got wrong.
* Bit operations: It says "none", but it's present in Lua 5.3 and LuaJIT.
* Hex literals are prefixed with 0x
* String capitalization is used with string.upper, but it says "none".
* Arrays as function arguments is table.unpack(t), or just unpack(t), depending on the Lua version.
* Iterate over range is for i=1,100 do --[[ code here ]] end
* The dictionary size example uses a loop, when you simply could have used #d
* Sort by values is table.sort
* Command line options are ...
... Anyway, I have to go. There are way more errors in this, with regards to Lua anyway. I wouldn't use this reference.
- tyre 10y agoI don't think the author should "fix" this. If these are language features but undocumented, then for all intents and purposes they don't exist.
- rweichler 10y agoWhen I said undocumented, I was saying that it's undocumented in this reference. I'll edit that part out to avoid confusion.
- tedunangst 10y agoAdd closures to the list. Also, I thought it's really strange that scripting languages 1 and 2 have different tables. Even if the tables were complete and accurate, can't compare javascript and lua because the rows are different.
- azdle 10y agoIt looks like they take contributions: https://github.com/clarkgrubb/hyperpolyglot https://github.com/clarkgrubb/hyperpolyglot
- deleted 10y ago[deleted]