#no you shouldn t do that
1 messages · Page 1 of 1 (latest)
You do realize that he's assigning the length of getObjects() two lines above, right?
Hm? He isn't, he's passing carte[#carte].index which is the .index field of last element of the table. Which is good.
Which he just got by getting it with the table's size.
Huh? I'm not sure we're talking about the same thing.
carte is a table returned from obj.getObjects()
#carte is its size
carte[#carte] is the last element of the table, describing the last card in the deck in this case
carte[#carte].index is the index of the last card in a deck, suitable for passing into e.g. obj.takeObject
https://api.tabletopsimulator.com/object/#getobjects-containers
Containers return a (numerically indexed) table consisting of sub-tables that each have the following properties:
Could you explain a case where the size of a deck isn't the index of it's last card/element?
Any given case. The docs don't state any assumptions about index number, it could be 0 or 1 indexed, or whatever really. It's an internal index. The fact that it behaves in some specific way now, doesn't mean it will keep behaving like that when TTS is developed.