I ran into this problem for a second time, i want to init an object using a function instead of writing alot of attributes.
and I get this error
this code recreates the problem in a simplified way:
hacked my way out of this one myself (if anyone has a better way ill be glad to see it).
I leave this as a future reference.
the solution:
and I get this error
this code recreates the problem in a simplified way:
Code:
items?[5]
rem this works fine
items[0] = createItem(1,2)
rem this dosnt work
c = createItems(items)
rem create objects
function createItems(&its?[])
for i=0 to sizeof(its)-1
rem this line returns error
b? = createItem(1,2)
its[i] = b
rem
next
endfunc
rem create object
function createItem?(x,y)
i?
i.x=x
i.y=y
return i
endfunc
wait keydown
hacked my way out of this one myself (if anyone has a better way ill be glad to see it).
I leave this as a future reference.
the solution:
Code:
items?[5]
rem now it works
items?[] = createItems(5)
rem create objects
function createItems?[](objnum)
its?[objnum]
for i=0 to sizeof(its)-1
b? = createItem(1,2)
its[i] = b
rem
next
return its
endfunc
rem create object
function createItem?(x,y)
i?
i.x=x
i.y=y
return i
endfunc
wait keydown