Hello, I would like to know if there is any difference between using addEventHandler in these 2 ways as shown below:
A:
local list = {
{-2172.03833, -2286.10107, 29.63500, 1.75},
}
addEventHandler("onResourceStart", resourceRoot,
function ()
for i, v in ipairs(list) do
local Mark = createMarker(v[1], v[2], v[3], "cylinder", v[4], 255, 255, 255, 50)
end
end)
B:
local list = {
{-2172.03833, -2286.10107, 29.63500, 1.75},
}
function create()
for i, v in ipairs(list) do
local Mark = createMarker(v[1], v[2], v[3], "cylinder", v[4], 255, 255, 255, 50)
end
end
addEventHandler("onResourceStart", resourceRoot, create)
In the first example (A) I can make it work in the MTA, but in the second example it doesn't seem to work and I get the following error: stack overflow.
Could someone tell me what the difference is between using addEventHandler before the function and after?
and why In the second example (B) am I getting an error?
I would be grateful for the help, thank you.