Variables turning nil when it shouldn't be?

  1. What do you want to achieve? To prevent these variables from going nil.

  2. What is the issue? These variables are turning nil when they’re not supposed to be.

The variables:
image

What its returning to me:

  1. What solutions have you tried so far? I have tried to look it on google/youtube or even other devforum posts, but i can’t seem to find a solution.

Have you tried printing the variables beforehand?
e.g print("random room: "..randomRoom.Name)

What about room.info? Show me the whole tree (if it exists)

image

It’s nil because, for example, hasStairs won’t automatically resolve to nil if the key doesn’t exist in the randomRoom. You should either add the keys to all rooms, or make an if statement that turns hasStairs to false if it’s nil.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.