"A Fine Mint" issue. LUA


#1

I am having a error stating the pickUpCoin function given is not defined.
Here is the function provided
function pickUpCoin()
local coin = self:findNearestItem()
if coin then
self:moveXY(coin.pos.x, coin.pos.y)
end
end
Not sure if this is a Error on my part or not.


#2

@PierceQuantum I don’t have the time right now to figure out why but here is a forum post talking about the issue:

Basically set all functions up as local for now as in:

local function someFunction () 
    -- Your LUA code here
end

and then call them by using a local variable assignment such as:

while true do
    local a = someFunction()
end

And your code will start to work!

When I get more time I will look into why, and if there is a better way to do this.

-HW

LUA reference manual: https://www.lua.org/pil/contents.html
RTFM if you can (Read the Fine Manual)


#3

@PierceQuantum another post provided by @Serg

I will look into my local unix install. If I remember correctly I had LUA running as a scripting engine for a console AI bot to handle different situations in an old game. Maybe a few months on this though.

- - May the code be with you…