I want to use CCArray to pass array of objects between lua and c**.
Unfortunately, when I add objects to CCArray in Lua, they are unusable afterwards.
local arr = cocos2d.CCArray:array
for i = 1, 10 do
local test1 = ogs.OGSScrollTableEntry:newEntry — <- this is just a CCNode with few additional methods
local spriteTest1 = cocos2d.CCSprite:spriteWithFile
local testObj = arr:objectAtIndex
cocos2d.CCLuaLog.x) — <- attempt to call method ‘getPosition’
I’ve tried to just pass the array to c** and deal with it there, but I get the same error.
After I cast the object from array to OGSScollTableEntry I cannot use any of the CCNode methods.
How can I pass an array of objects from Lua to c++?
My current workaround is to create CCArray when instantiating object and adding entries one by one from Lua. It works this way.