Possible bug in restoring lists on game load

Started by stewbasic, April 19, 2014, 03:15:36 PM

Previous topic - Next topic

stewbasic

It seems that if a core has an empty list assigned to a variable, then when the game is loaded GetListCount returns 1 instead of 0. The list appears to still be empty as expected. Here's a minimal example.


once
CreateList ->list
endonce

SetText(GetListCount(<-list))

:Awake
ShowTraceLog
Trace2(<-list GetListCount(<-list))


The core's text is initially 0 as expected. However after loading the game the trace shows "[] 1" and the core's text changes to 1 (after 1 frame). If the list is not empty, everything works as expected.

kwinse

Odd indeed.

Curious though, why the (TRUE)? ShowTraceLog doesn't take any arguments so all you're doing is leaving a 1 on the stack (which isn't the source of this).

stewbasic

Quote from: kwinse on April 19, 2014, 04:36:26 PM
Curious though, why the (TRUE)? ShowTraceLog doesn't take any arguments so all you're doing is leaving a 1 on the stack (which isn't the source of this).
Ah you're right, thanks. I'll correct the original post.

knucracker

Looks like an empty list when loaded gets created with an empty string as an element.  This is a bug in the way the game loads a serialized list.  I will fix this... and hopefully it won't break anything.  I'm guessing that no existing maps have persisted empty lists for any intentional purpose.