Sandboxed LuaCombinator

Program combinators with lua. Now there is a version with outputs isolated from inputs!
a month ago
0.17 - 0.18
Owner: IWTDU
Source: N/A
License: CC BY-SA 4.0
Created: 2 months ago
Latest Version: 0.4.1 (a month ago)
Factorio version: 0.17 - 0.18
Downloaded: 466 times

Based on OwnlyMe's LuaCombinator 2 mod.
Main differences:
- Less overhead when using circuit network
- No cheating, very restricted access to game api
- There is a version with outputs isolated from inputs

Currently accessible game api elements:

Multiple inputs/outputs

Starting from 0.4.0 you can place additional inputs and outputs. Craft and place them on tiles adjacent to combinator (max 4 positions per combinator for both combinator types). You will see "Assigned" floating text if you are doing it right.
Previously there was api for only one input and one output, so now there is a new api (old still works, now through new one). This new api is:
- outputs table, use it like outputs[2]['signal-B'] = 10
where 2 is output number (1 is combinator's output, then 2,3, and so on are additional outputs by built order)
#outputs is output count including built-in output
you can reset output to desired state by assignment like outputs[2] = { ['signal-C'] = 10 }
- inputs table, indexed same as outputs
local A = inputs[1].red['signal-A']
local inp_count = #inputs

-- sum everything on green input 2 and set as S signal to output (once in game second)
local g = inputs[2].green
local s = 0
for k,v in pairs(g) do
output['signal-S'] = s

Bugs, errors

Please, report bugs instead of hoping that I know about them. Even "obvious" bugs may not be noticed by me because often there is more fun in programming mod than playing with it.

Code on this mod's combinators can only interface game world with reading and sending signals from/to connected circuit networks. Every combinator code executed isolated from game, mods and other combinators namespaces. Otherwise you can use all power of lua for processing that signals (what is the main thing required from combinator). Global variables are preserved always, no need for 'var', 'var' now is just a variable like any other combinators variable.

Most of code for LuaCombinator2 should work, including examples from it's page.