cocos2d::CCArray* stays a normal CCArray usertype in Luau.
Codegen adds a small set of read methods from Geode/cocos/cocoa/CCArray.h.
CCArray exposes Cocos read methods:
count()capacity()objectAtIndex(index)indexOfObject(object)containsObject(object)firstObject()lastObject()randomObject()
Example:
local lists = localLevelManager:getCreatedLists(0)
if not lists or lists:count() == 0 then return nil end
local first = lists:objectAtIndex(0)objectAtIndex uses Cocos indexes. The first item is index 0.
These methods bind as normal CCArray methods.
Return values such as getCreatedLists() still return CCArray?, not a table view.
objectAtIndex, firstObject, lastObject, and randomObject return CCObject* in C++.
When pushing these to Lua, codegen tries to keep the object's right type,
so if the element is a subclass like GJLevelList and it is registered, Lua gets that type.
Generated stubs still use CCObject?, but you can annotate like :: GJLevelList? for type checking.
If an exact runtime type is not registered, LuauAPI uses the closest registered match.
It falls back to CCNode for node objects, then CCObject.
CCArray.dataandcocos2d::ccArray*internals- Writable array helpers until retain and release behavior is audited
- Broad conversion of
CCArray*returns into Lua arrays
tools/luau_codegen/parse/geode_sdk.pytools/luau_codegen/parse/collect.pytypes/geode.d.luau