-
Monster Iestyn authored
Write a new hack for getting sector->linecount from sector->lines in Lua, to put my mind at rest about it at last. 1) In sector_get, actually push the memory address of the lines array within sector_t, rather than push the value of "lines" itself (essentially, we we want a pointer to a double pointer, or rather a TRIPLE pointer haha) 2) In the sectorlines_* functions, use offsetof to shift the memory address so we can obtain the value of linecount within the sector_t struct, and dereference the result to obtain the value of linecount itself 3) ??? profit Untested and uncompiled atm, but I have some confidence this might work
Monster Iestyn authoredWrite a new hack for getting sector->linecount from sector->lines in Lua, to put my mind at rest about it at last. 1) In sector_get, actually push the memory address of the lines array within sector_t, rather than push the value of "lines" itself (essentially, we we want a pointer to a double pointer, or rather a TRIPLE pointer haha) 2) In the sectorlines_* functions, use offsetof to shift the memory address so we can obtain the value of linecount within the sector_t struct, and dereference the result to obtain the value of linecount itself 3) ??? profit Untested and uncompiled atm, but I have some confidence this might work