Moon Logic deprecated

by mk-fg

Adds Lua-programmable circuit network combinator. Based on Sandboxed LuaCombinator and LuaCombinator2 mods. Probably won't work in multiplayer games.

Content
2 years ago
1.0 - 1.1
4.97K
Circuit network

b [fixed] Crash with complex/weird output signal assignments

3 years ago

Got this error when connection a red wire. Couldn't figure repro step sorry.

The mod Moon Logic (0.0.72) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Moon_Logic::on_tick (ID 0)
(serpent):85: Unknown signal: 1
stack traceback:
[C]: in function 'error'
Moon_Logic/control.lua:89: in function 'cn_sig'
Moon_Logic/control.lua:111: in function 'cn_input_signal'
Moon_Logic/control.lua:116: in function 'index'
(serpent):85: in function 'val2str'
(serpent):124: in function <(serpent):15>
(...tail calls...)
__Moon_Logic
/control.lua:627: in function 'update_signals_in_guis'
Moon_Logic/control.lua:769: in function <Moon_Logic/control.lua:738>

3 years ago
(updated 3 years ago)

I just started playing with the mod and I think I had delay = 1; game.print(red); as my only code on two line.

3 years ago

Hm, yeah, game.print() certainly uses serpent for pretty-printing tables, but it should also make a clean copy of these tables before that, to avoid exactly this sort of thing.

I think corner-case might be something like a = {red}; game.print(a), as it doesn't do a deep scrub, but maybe either should, or just handle and suppress errors, printing something like [unprintable or recursive thing] instead of such crash.

Will check it out and fix. Thanks for reporting!

3 years ago

Oh, also first traceback indicates something different than error during game.print, something like 1 ending up in a signal table, weird.

3 years ago
(updated 3 years ago)

delay = 1 btw pretty sure is the default anyway, as it's not one human second (60 ticks at 1x speed), but rather one in-game tick - the smallest unit of time in factorio.

3 years ago

or just handle and suppress errors, printing something like [unprintable or recursive thing] instead of such crash.

Right, that's already handled, as a regular combinator error, and definitely unrelated to traceback in the original msg.

3 years ago

Couldn't figure repro step sorry.

Easiest way seem to be something like out.a = red, which then tries to pretty-print erroneus value in the GUI on the right, and because that value is kinda special (that sandboxed "red" table), gets that error.

Should be fixed in 0.0.73, where it'd print <err> instead of any unprintable values.
Thanks again for noticing and bothering to report :)

3 years ago
(updated 3 years ago)

Easiest way seem to be something like out.a = red

Now that you mention it I think I did indeed write something along the line of that just before closing the windows and starting playing with the cable. I had accidentally plugged the red cable on a belt behind my electric pole instead of on that pole, so I was trying to debug why the signal input wasn't working. Nice catch!

­> delay = 1 btw pretty sure is the default anyway

Yeah I know I had put it higher initially and put it back to 1 after to debug stuff.

The funny thing is I told my brother 10 min earlier that the mod was sandboxes so he didn't need to worry about me crashing the game and then this happen. 2 second later I see a message pop up in Steam from him with a screenshot and the caption "I though you said this wouldn't happen.." loll

Thanks for the quick fix!

3 years ago

The funny thing is I told my brother 10 min earlier that the mod was sandboxes so he didn't need to worry about me crashing the game and then this happen

Hope you don't mean a multiplayer game there, as those also not supposed to work with the mod either :)

But yeah, not supposed to happen, with a couple caveats like such bugs, or if you use kinda-hidden _api thing (where you can easily break everything), and/or if you are deliberately trying to break it (not a secure computation platform in adversarial context, obviously, doubt anything lua-based can reasonably be that).
This particular bug was apparently introduced on Oct 20 2020, so a year ago almost to a day, but if anyone else using the mod managed to trigger it, guess they didn't report it.

3 years ago

Do you think the multiplayer might have triggered it?

3 years ago

No, it should not, pretty sure you'll get desyncs with it, but that should be the only issue afaik.
Just thought to mention in case you didn't notice the warnings in the description, FAQ or other threads here.

New response