News for hackers. Stuff that matters.
Re:Lua and Python (2020) by BugsJustFindMe on Friday January 15, 2021 @05:03PM (#25797134)
> aren't there non-arithmetic functions that also error? What's the message in that case?

Any function can error in any way imaginable, but if we're talking about built-ins...

`print(nil.."a")` -> "attempt to concatenate a nil value"

`print(({}).foo.bar)` -> "attempt to index a nil value (field 'foo')"

`table.insert(a, 1)` -> "bad argument #1 to 'insert' (table expected, got nil)"

On the Python side you get:

`None[1]` -> "TypeError: 'NoneType' object is not subscriptable"

`str.split(None, "d")` -> "TypeError: descriptor 'split' for 'str' objects doesn't apply to a 'NoneType' object"

There are no comments on this comment yet.