I was following the simple “runner tutorial” with a twist of my own and i noticed that if i call a local function inside the update function of the “hero.script” i get this error:
> ERROR:SCRIPT: hero/hero.script:36: attempt to call global 'test' (a nil value)
> stack traceback:
> hero/hero.script:36: in function <hero/hero.script:24>
@0angelic0 is right. The local function must be declared before the code that is calling the function. If you have two local functions that want to call each other then you can use forward-declaration of the functions:
local a
local function b()
a()
end
a = function()
b()
end