I need help with the usual day level codecombat lua

It is a little hard for me to tell what is going on, but this doesn’t look like javascript.

Please format your code. See this link about how to format your code. Put three backticks, then on the next line copy and paste all of your code, then put three more backticks.

You want to follow the pattern from the first part of this program

Here is the first part:

local enemy = hero:findNearestEnemy()
-- With AND, the type is only checked if enemy exists.
if enemy and enemy.type == "munchkin" then
    hero:attack(enemy)
end

The idea is to do the same thing in the next part, but instead of enemies, munchkins and attacking it will be items, coins and moving.

1 Like