[MOD 0.18] Sandboxed LuaCombinator

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

[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
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).
(156.13 KiB) Downloaded 28 times
(154.19 KiB) Downloaded 18 times
(138.5 KiB) Downloaded 23 times

User avatar
Long Handed Inserter
Long Handed Inserter
Posts: 68
Joined: Sun Jan 06, 2019 2:46 pm

Re: [MOD 0.18] Sandboxed LuaCombinator

Post by _Attila_ »

The mod Sandboxed LuaCombinator (0.4.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event SandboxedLuaCombinator::on_gui_opened (ID 83)
__SandboxedLuaCombinator__/script/gui.lua:90: attempt to index field '?' (a nil value)
stack traceback:
__SandboxedLuaCombinator__/script/gui.lua:90: in function 'create_gui'
__SandboxedLuaCombinator__/script/gui.lua:20: in function 'open'
__SandboxedLuaCombinator__/control.lua:980: in function <__SandboxedLuaCombinator__/control.lua:972>

I am using a mod https://mods.factorio.com/mod/GhostPlacerExpress that revives ghosts to place an item. I am guessing your mod does not support the defines.events.script_raised_revive event and so does not recognize the combinator when it is selected. Mod also crashes if trying to remove it.
Attila's QuickBar Mod - Auto-links hand crafted item to first free quickbar slot if not already linked.
Attila's Signals Mod - Alternate signals to use in same circuit as standard signals.
Attila's Zoom Mod - Modifies zoom functionality.

Post Reply

Return to “Mods”

Who is online

Users browsing this forum: DJQuad, Ondras4620