The hoarding gold. LUA. some trouble in there


#1

– Collect 25 gold, and then tell Naria the total.
– Use break to stop collecting when totalGold >= 25.
local totalGold = 0

loop
local coin = self:findNearestItem()
coin=coin.pos
coinx = coin.x
coiny = coin.y
self:moveXY(coinx, coiny)

-- Add the coin's value to totalGold. (See the guide for more.)
-- Get its value with:  coin.value
-- Pick up the coin.
-- Add the coin's value to totalGold. (See the guide for more.)
-- Get its value with:  coin.value
totalGold = totalGold + coin.value;
if totalGold >= 25 then
    -- >= means totalGold is greater than or equal to 25.
    -- This breaks out of the loop to run code at the bottom.
    break
end

end

– Done collecting gold!
self:moveXY(58, 33)
self:say(“Hi Naria, I collected totalGold .gold!”)
– Go to Naria and say how much gold you collected.

this is my work the porblem is

totalGold = totalGold + coin.value;
I don’t know how to write it in the LUA.
it can’t work
totalGold += coin.value
too


#2

I have pass!
I still use the x=x+i
I HAVE PASS.
it not show mistake this time.