#no you shouldn t do that

1 messages · Page 1 of 1 (latest)

severe siren
#

You do realize that he's assigning the length of getObjects() two lines above, right?

lean dragon
#

Hm? He isn't, he's passing carte[#carte].index which is the .index field of last element of the table. Which is good.

severe siren
#

Which he just got by getting it with the table's size.

lean dragon
#

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

severe siren
lean dragon
#

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.

severe siren
#

Maybe I'm reading what I quoted just wrong. My bad for misunderstanding numerically indexed then.

#

🤷

lean dragon
#

I've just checked in game, and a three-card deck logs this data from self.getObjects()

#

so the last index is 2, so #carte - 1 and not #carte (table array length is 3)