Sandboxed LuaCombinator

by IWTDU

Program combinators with lua. Now there is a version with outputs isolated from inputs!

Content
4 years ago
0.17 - 0.18
16
Circuit network

i Expanding the ability to access tables

3 years ago

When running the code, the Combinator does not write anything, because the game.recipe_prototypes and game.item_prototypes tables can only be accessed if a specific key is known. Everything works correctly in the factorio API and in LuaCombinator3, and you can see all the recipes in the output.
Solving the problem will save space for the scheme for craft combinator and make it more robust.

local recipe = game.recipe_prototypes[recipe_name]
for name, val in pairs(recipe) do
print(name)
end

3 years ago
(updated 3 years ago)

Update make_custom_table_proxy function with this code and problem will be solved with recipe_prototypes/item_prototypes iteration.

local function make_custom_table_proxy(ct_game_key)
local custom_table_proxy_mt = {
__index = function (tbl, k)
return game[ct_game_key][k]
end,
__pairs = function (tbl, k)
local fn = pairs(game[ct_game_key])
return fn
end
}
return setmetatable({}, custom_table_proxy_mt)
end

New response