Take this example control.lua as soon as the game.raise_event is executed the on event function doesn't receive the event nor does the line after game.raise_event get executed.
All future on_tick event are also blocked/ignored for my mod until I save and reload the game save. Then on_tick works until game.raise_event is triggered again.
Code: Select all
require "stdlib/log/logger"
tlog = Logger.new(MODNAME)
myevent = script.generate_event_name()
script.on_event(defines.events.on_tick,function()
if game.tick % 300 == 0 then --every 5 seconds for testing
tlog.log("Raising event [" .. myevent .. "] for game.tick == " .. tostring(game.tick))
game.raise_event(myevent, {a="c"})
tlog.log("Raised event for game.tick == " .. tostring(game.tick))
end
end)
script.on_event(myevent, function(event)
tlog.log("I got the event! [" .. event.a .. "]")
end)
[edit]
So I started trying this mod in 0.13.0 and going up a version at a time. It worked like expected in every version. Even 0.13.13 which is the version I was originally having issues it. Weird. Whatever works now so ignore this post.