Code: Select all
local control_behavior = some_constant_combinator_entity.get_or_create_control_behavior()
control_behavior.parameters = {parameters = table_of_signals}
Code: Select all
local control_behavior = some_constant_combinator_entity.get_or_create_control_behavior()
control_behavior.parameters = {parameters = table_of_signals}
Lua *is* that slow. Especially so when it comes to the creation of small strings since all strings in Lua are interned. Something you do a ton of when working with signals.MagmaMcFry wrote:I already tested that commenting out the second line makes the 0.1ms per signal go away completely, so either the majority of those 0.1ms is spent translating one single signal (two tables with four entries total) from Lua into C++ (which I sorta doubt because Lua can't be that slow), or there's something weird with the C++ routine.
That would be useful for at least some of my mods!Rseding91 wrote:I can add a different method "set signal" which lets you set individual signals. If you don't plan on changing more than a few it would be faster than doing parameters = ...
The advantage being you can set 1 signal and leave the rest intact (if that's what you wanted to do).