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] Inconsistent behavior of out variable

3 years ago

Hello.
The button to show the environment variables window clears all environment variables when right-clicked, however the out variable is not cleared.
https://i.imgur.com/EdUWd0R.gif
I think that the out variable should be cleared as well.

On the other hand, when I disconnect and restore power to the MLC, the environment variables are retained, but the out variable is cleared.
https://i.imgur.com/wtohKdp.gif
I'm not sure which is correct, whether the variables should be retained or cleared when the power is disconnected, but I thought they should at least be consistent one way or the other.

I don't know much about the past history of the mod, so maybe some policy makes it the way it is now.
I've reported this as a bug, but I'm sorry if these are the intended behaviors.

I am not fluent in English, so I am using web translation to write the text.
Please let me know if there are any parts of my text that do not make sense to you.

3 years ago
(updated 3 years ago)

You may not need it specifically, but here is the program code running in the image.


delay = 60
i = ( i or 0 ) + 1
out.wood = out.wood + 1
var[i] = out.wood


3 years ago

The button to show the environment variables window clears all environment variables when right-clicked, however the out variable is not cleared.

Intent there was to make it clear globals, and then also "var" as it's pretty much same thing (but indeed more historical artifact), but I didn't really think about clearing "out" there.
It's not shown in that same window as other vars (which left-click on that button shows) and is kinda special, so not sure if it'd be intuitive to clear it as well.

But a button to clear it would actually be nice, given that it's persistent, so guess I should add something like shift-rightclick on that same button to clear outputs separately, which should probably also work fine for your purposes - just one extra click, but more fine-grained control over what you discard.

3 years ago

On the other hand, when I disconnect and restore power to the MLC, the environment variables are retained, but the out variable is cleared.
I'm not sure which is correct, whether the variables should be retained or cleared when the power is disconnected, but I thought they should at least be consistent one way or the other.

Don't remember ever testing unpowering the thing, and didn't give much thought to what happens there when implementing it.

Clearing internal state would be a PITA and just more work, so probably a bad idea to add, but I think output should just be suspended in whatever state it was.
Not 100% sure how it works now, and hard to tell from the gif, but I think what currently happens is that contents of "out" table are retained, but underlying combinator outputs are cleared, though maybe "out" table is cleared too, again, not sure.
It'd indeed make more sense to be consistent with how internal vars work and just not process any changes, while retaining same constant outputs.
Kinda turn the thing into a constant combinator until power is restored.

3 years ago

I don't know much about the past history of the mod, so maybe some policy makes it the way it is now.
I've reported this as a bug, but I'm sorry if these are the intended behaviors.

Historically power was not checked at all, as base entity was a constant combinator with no power requirement, so when changing the thing into a 2-input/2-output arithmetic combinator (on a suggestion from one of the threads), added power checks as an afterthought, so there's no real history in that regard.

And same for clear-env button - don't think any earlier mods had it.
Added that functionality as an afterthought while making a button to show globals too, without really considering anything but what was shown in that new window.

Thanks for testing and pointing out these corner-cases, can't really track them all myself.

3 years ago

Thank you for your reply.

Certainly, if you think about it, testing while considering the power status can be difficult.
If that's going to be a hassle, don't worry too much about this. Your time is yours.

In fact, I'm not too in trouble.
When I was playing with a program that used the out value permanently, I just thought it would be nice if I could clear out without adding any program code.
As for the power-off operation, I just wrote what I noticed.

But a button to clear it would actually be nice, given that it's persistent, so guess I should add something like shift-rightclick on that same button to clear outputs separately, which should probably also work fine for your purposes - just one extra click, but more fine-grained control over what you discard.

I'm really happy if I can do this. Thank you.

3 years ago

Both issues should be fixed in 0.0.65. Thanks again for suggestions!

New response