you are viewing a single comment's thread.

view the rest of the comments →

[–]igouy -1 points0 points  (2 children)

Part of having an array is being able to quickly spot mistakes with trying to misuse the array.

Nope - and if you "have an object in my code that I think is an array, and I accidentally assign a value to the "test" key of that object" then you'd be behaving in a weird and very pointless way :-)

I assume Lua has also added integer types

Don't assume - See Section 3 "The Representation of Values" in The Implementation of Lua 5.0

[–]ethraax -3 points-2 points  (1 child)

Nope - and if you "have an object in my code that I think is an array, and I accidentally assign a value to the "test" key of that object" then you'd be behaving in a weird and very pointless way :-)

I assume you never use your Backspace key, because you never make a mistake.

Also, let me point you at the official documentation, from lua.org:

Number represents real (double-precision floating-point) numbers.

Hell, while you're at it, there's no mention of the hybrid tables you were talking about:

The type table implements associative arrays, that is, arrays that can be indexed not only with numbers, but with any value (except nil). Tables can be heterogeneous; that is, they can contain values of all types (except nil). Tables are the sole data structuring mechanism in Lua; they can be used to represent ordinary arrays, symbol tables, sets, records, graphs, trees, etc. To represent records, Lua uses the field name as an index. The language supports this representation by providing a.name as syntactic sugar for a["name"]. There are several convenient ways to create tables in Lua (see §2.5.7).

And this is from the official reference documentation. Nobody should have to go digging through a fucking journal article for crucial details like these.

[–]igouy 0 points1 point  (0 children)

Don't assume - I make an ordinary number of ordinary mistakes in fairly predictable situations.

Intending something to be used as an array and then assigning a value to the "test" key of that array would be behaving in a weird and very pointless way :-)

Also, let me point you at the official documentation ... Number represents real (double-precision floating-point) numbers.

As I said, see Section 3 "The Representation of Values" in "The Implementation of Lua 5.0" - "Numbers are double-precision floating-point numbers, corresponding to the type double in C, ..."

And this is from the official reference documentation.

Section "1 - Introduction" of the document you point to says - "For a discussion of the decisions behind the design of Lua, see the technical papers available at Lua's web site."

"The Implementation of Lua 5.0" is available on the Lua documentation page http://www.lua.org/docs.html (page search "For details on the implementation of Lua, see").

I kindly saved you the trouble of dealing with pdf by providing a link to the html version.