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

The If-Stravaganza level help? (LUA)


Please take a look at the picture below:

This what is the code that I wrote for the if-statement level. I’m 100% sure that I’ve written the code correctly and even searched up for the solution, in which I got similar to this. Though the code does not work when I execute it, instead it returns me with an error message saying “this.findNearestEnemy is not a function” as highlighted on line 4 of my code.

Does anyone know the solution to this? I’ve tried everything, thanks


Do you have the right glasses on?


try : instead of . and try to cleave, because you have a warrior

 local enemy = hero:findNearestEnemy()
     if enemy and self:isReady("cleave") then self:cleave(enemy)
        if enemy then self:attack(enemy) 


Yeah your prediction was correct, I didn’t have the right glasses on >_<

But it’s strange since the glass that I’m using in the screenshot had the “findNearestEnemy” function and is more advanced then the beginner glass - which only had one function, the “findNearestEnemy”. Yet I had to equip that specific one in order for it to work. Could this be an unnoticed bug?


it says i cant use ‘local’ or ‘enemy’


Post your code. Make sure you are using the right language, local is only for LUA, use var for JS and nothing for Python.

Lua: local enemy =

Js: var enemy =

Python: enemy =


I still cant get it to work can you help me?


Please post your code so we can assist you. Remember to use the </> button so it formats properly.


while True:
enemy = hero.findNearestEnemy()

I am so confused on this level


You started the level in LUA? ?
You code can be similar to:

while true do
    local target = hero:functionToFindTheEnemy()
    if target then
        hero:attackTheEnemy(target )


it wont let me do local


if you click the link:
image click restart
and then write you code:
I suppose you really want LUA


can’t click the link


never mind I got the link to work


I don’t know what to do after that


Just do what the comments say, and if you’re stuck, try reading the hints