[MOD 0.18] Sandboxed LuaCombinator

Topics and discussion about specific mods
Post Reply
IWTDU
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Apr 04, 2019 8:46 am
Contact:

[MOD 0.18] Sandboxed LuaCombinator

Post by IWTDU »

I recently found mod named LuaCombinator2, and I liked it's idea but not implementation, so I 'improved' it (if I correctly understood CC BY-SA 4.0 license it is fine). So here it is:

Sandboxed LuaCombinator
https://mods.factorio.com/mod/SandboxedLuaCombinator
Adds combinators programmed with lua.

"Sandboxed" because that is main difference from original mod - each combinator's code works isolated from other's and from game api, so can only interact world with circuit network signals using special variables named: rednet, greennet, output, which are tables indexed by signal name (like 'signal-A'). rednet and greennet are read-only, to send signals write them to output table (like output['signal-A'] = 1 ). Also there is special variable delay: after executing code of combinator once, next execution will be after delay ticks passed, otherwise - on next tick. Don't place infinite (or too long) loops inside - it will hang the game. However, currently it is the only (known) way to negatively affect game with 'bad' code, because unlike in original mod, game api or any external variables are inaccessible (please report as bug otherwise).

Unlike in original mod, global (from inside combinator perspective) variables are always preserved, so there is no need to use special table 'var' to save them. For compatibility, 'var' is defined by default as empty table, but otherwise it is regular variable.

Compatible with code for LuaCombinator2, if that code use only circuit networks and pure lua. Examples from it's page all works.
Optimized to have less overhead on reading/writing signals. Currently up to 40% faster than original (in benchmark where lots of combinators reads and writes signals each tick).
Attachments
SandboxedLuaCombinator_0.3.1.zip
(156.13 KiB) Downloaded 4 times
SandboxedLuaCombinator_0.2.3.zip
(154.19 KiB) Downloaded 3 times
SandboxedLuaCombinator_0.2.1.zip
(138.5 KiB) Downloaded 6 times

Post Reply

Return to “Mods”

Who is online

Users browsing this forum: marcus