Talk:Table.size: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 4: Line 4:


--[[User:Subenji99|Subenji99]] 06:54, 13 July 2009 (CEST)
--[[User:Subenji99|Subenji99]] 06:54, 13 July 2009 (CEST)
----
table.getn was replaced by the #-operator, which returns the number of table elements with a numerical (!) index.<br/>
table.size counts all elements regardless of which type their index is.<br/>
Of course it's a bad idea to use this function for a table with only numerical indices.<br/>
[[User:NeonBlack|NeonBlack]] 16:19, 13 July 2009 (CEST)

Revision as of 14:19, 13 July 2009

What about using the builtin lua function:

table.getn(table)

--Subenji99 06:54, 13 July 2009 (CEST)


table.getn was replaced by the #-operator, which returns the number of table elements with a numerical (!) index.
table.size counts all elements regardless of which type their index is.
Of course it's a bad idea to use this function for a table with only numerical indices.
NeonBlack 16:19, 13 July 2009 (CEST)