Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

[Solved] Level: LUA: Possible issue with Wizard's Door


When attempting the level Wizard’s Door using the LUA language, I cannot get the number from Laszlo. I can get his instructions, so know what to do with it to get the next number.

I use the following code but the line ‘local secret2 = secret+7’ gives the error “Attempt to perform arithmetic on a null value: undefined”

--# Move to Laszlo and get his secret number. self:moveXY(30, 13) local secret = self:findNearestFriend().getSecret() --# get instructions self:say("Secret?") --# Follow Laszlo's instructions to get Erzsebet's magic number! --# Move to Erzsebet and say her magic number. local secret2 = secret+7 self:moveXY(17, 26) self:say(secret2)
(edited to format code correctly)


Could you please post a screenshot and explain more about what you are having issues with


@Luke10 I have already given a complete explanation of the issue above, including the error message.

The code (which should give you the number to use for the rest of the program):
local secret = self:findNearestFriend().getSecret()
does not populate the secret number (the value of the variable is null). This means when I try to use the value later in the code, it throws an error as you cannot add a number to a null value. (I work as a programmer so I know WHAT the issue is, but obviously I can’t fix it as it is an issue with the level)

But here is all of the information in my above post as a screenshot, since you asked for it :slight_smile:


Just to add, when I run the same level using Javascript, it works correctly (and I can pass it); it is only LUA that is not populating the secret number correctly.


On the part where it says fix your code. What line is it talking about.


Exactly the line I identified in both of my messages above :slight_smile: Line 8 in the screenshot. Thanks for trying to help, but it is not a syntax problem with my code. It is a bug with the level not populating the secret number in line 4 when using LUA. I have done the same level in Javascript and it populates the value correctly.


Solved: The issue was with the sample code provided. I have put a patch in for the LUA sample code.


I know that this topic is solved but you didn’t exactly define what line the issue was on. Most people probably wouldn’t be able to understand ’local secret2 = secret+7


Hey Luke, that’s why I posted the code along with it :slight_smile: which contains the comments that the template provides… and followed up with the screenshot which highlighted the line. The error wasn’t with that line though (as I explained at the time), it was with line 4, which was part of the sample code.
Nevermind, it is sorted now, and a patch submitted to fix it for the future.