I have been experimenting with on_nth_tick, and had a question. When I do a simple experiment in my control.lua to add an on_nth_tick handler it works. When I have another event handler call on_nth_tick(#,nil) to remove that handler, the tick handler is disabled as expected.
The issue is that the on_nth_tick hook I'd like to unregister comes from a different mod. When I call on_nth_tick with the tick number used by that mod, nothing happens and the handler keeps happening. Calling on_nth_tick with nil only seems to affect my own mod. This, coupled with the fact that script has a read only member called mod_name makes me think that each mod is using a different script variable. Is there some way to replace a different script's tick handler?
on_nth_tick question
Re: on_nth_tick question
Only if that mod makes a remote interface allowing you to do so.Anachrony wrote: Sat Feb 08, 2020 7:58 pm Is there some way to replace a different script's tick handler?
Mod scripts are sandboxed, so they each have their own event listeners, data, and global
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_nth_tick question
Slight expansion/correction: Mods are seperated only in control stage (i.e. "control.lua"). All other stages (settings.lua, data.lua, etc) use a single lua state that is shared between all mods.Klonan wrote: Sat Feb 08, 2020 8:50 pm Mod scripts are sandboxed, so they each have their own event listeners, data, and global
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.