So I have funct. A and funct. B like this:
local function A (event)
B()
end
local function B (event)
–do stuff
end
I want to call function B from function A, but due to the fact that B come after A I keep getting the error "Runtime error
/Users/Stiven/Desktop/Chow-Down/game.lua:457: attempt to call global ‘B’ (a nil value)
stack traceback:
[C]: in function ‘B’
/Users/Stiven/Desktop/Chow-Down/game.lua:457: in function
?: in function <?:215>
"
Is there a way to surpass this error?
And no, I can’t switch the order around.
[import]uid: 130035 topic_id: 24004 reply_id: 324004[/import]
Sure, before function A declare function B
local functionB = nil
local functionA(event)
end
functionB(event)
end
LOL… this is the answer i SHOULD have provided another peep today instead of just telling him to check his scope!
Good luck! [import]uid: 21331 topic_id: 24004 reply_id: 96728[/import]
Thank You!!!
This worked and it will resolve so many of my problems!!!
Oh, and you forgot to put “function”
[lua]local functionB = nil
local function functionA(event)
end
function functionB(event)
end[/lua]
just for anyone who doesn’t know.
Thanks again [import]uid: 130035 topic_id: 24004 reply_id: 96747[/import]
Doh! Your most welcome! Thanks for making the thread answer correct! 
[import]uid: 21331 topic_id: 24004 reply_id: 96855[/import]