[0.18.10] [Documentation?] calling on_nth_tick(nil, anything) gives error
Posted: Sun Mar 08, 2020 3:48 pm
According to the documentation:
Actual code:
Factorio error:
The error also occurs with
I found viewtopic.php?t=71803, which reports it as not-a-bug saying the correct call is on_nth_tick(nil) -- but that's in opposition to what the documentation says.
Can either the documentation be updated to reflect the proper calling convention, or update the function to act according to the documentation?
Thanks!
Code: Select all
on_nth_tick(tick, f)
Register a handler to run every nth tick(s). When the game is on tick 0 it will trigger all registered handlers.
Parameters
tick :: uint or array of uint: The nth-tick(s) to invoke the handler on. Passing nil as the only parameter will unregister all nth-tick handlers.
f :: function(NthTickEvent): The handler to run. Passing nil will unregister the handler for the provided ticks.
Code: Select all
Events.findall_radars()
script.on_nth_tick(nil, nil)
script.on_nth_tick((global.Mod.PanopticonRechartInterval * 60), Events.rechart_base)
Code: Select all
Error while running event Panopticon::on_runtime_mod_setting_changed (ID 59)
First argument must be a number or table.
stack traceback:
__Panopticon__/control.lua:21: in function 'UpdateSetting'
__Panopticon__/control.lua:35: in function <__Panopticon__/control.lua:34>
stack traceback:
[C]: in function 'on_nth_tick'
__Panopticon__/control.lua:21: in function 'UpdateSetting'
__Panopticon__/control.lua:35: in function <__Panopticon__/control.lua:34>
Code: Select all
script.on_nth_tick(nil, Events.rechart_base)
Can either the documentation be updated to reflect the proper calling convention, or update the function to act according to the documentation?
Thanks!