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

g [lua-qiz] What i am doing wrong??

3 years ago

Hello,
I just started to use the moon logic i am trying to send signals with the difference that I have
red wire is stock items
out['splitter'] = 100 - red.splitter
out['rail']=500 - red.rail
out['transport-belt']=300
out['fast-transport-belt'] = 1000 - red.fast-transport-belt
out['express-transport-belt'] = 1000 - red.express-transport-belt

in some items like fast-transport-belt i am getting an error
RuntimeError: ......... 4: Unknown signal name: fast

and this is the picture also
http://prntscr.com/w9pe1l

Am I doing something wrong?

3 years ago
(updated 3 years ago)

Yeah, it's probably a bit counter-intuitive for those who don't use programming languages often, but aside from lisp family of these, dash is always a minus sign and cannot be used outside of string literals for anything but subtraction (mathematical) operator.
So red.fast-transport-belt that you have there can also be written as red.fast - transport - belt, i.e. red.fast value minus transport value minus belt value.

3 years ago

Given that this mod does not mangle signal names in any way, the way to use keys with dashes, spaces, plus signs and any other reserved punctuation in lua language is that other form with brackets and string key, e.g. out['fast-transport-belt'] or red['express-transport-belt'], where string literal can obviously contain absolutely anything (if properly escaped) and lua won't complain :)

3 years ago

Great thanks for the explanation..

New response