ENIGMA Forums

Outsourcing saves money => Issues Help Desk => Topic started by: impo on February 13, 2019, 11:36:21 AM

Title: bug with data structures?
Post by: impo on February 13, 2019, 11:36:21 AM
create an object and add to Draw Event:
Code: [Select]
if (ds_list_exists(any_variable_here))
draw_text(200,200,"mylist exists")

put object on the room and try to run it. no text should be displayed

now create another object or use this one (doesn't really matter), and put this code on Create Event:
Code: [Select]
any_list_name=ds_list_create()
try to run the game again. in my case ds_list_exists returns 1 with any existing ds list in the room, regardless of whether this is the ds list I checked for existence or not. 

is this program behavior common to everyone, or is it just me? and if its common, did i use the function wrong, or is there actually a bug?
Title: Re: bug with data structures?
Post by: impo on February 13, 2019, 12:30:38 PM
the problem is that if the list actually exists, this function successfully checks its existence. but if there is no such list, the function can't find what to check, and instead of returning zero, checks existence of the first created list in the room (or zero, if there are no lists at all)
Title: Re: bug with data structures?
Post by: Goombert on February 13, 2019, 01:57:24 PM
GM8 does the same, it's because you have the game setting "Treat uninitialized variables as 0" enabled.