Files
factorio-scenario-ExpCluster/exp_legacy/module/modules/gui/debug/model.lua
Cooldude2606 7ab721b4b6 Refactor some of the Guis from the legacy plugin (#399)
* Fix bugs in core and add default args to Gui defs

* Refactor production Gui

* Refactor landfill blueprint button

* Fix more bugs in core

* Consistent naming of new guis

* Refactor module inserter gui

* Refactor surveillance gui

* Add shorthand for data from arguments

* Make element names consistent

* Add types

* Change how table rows work

* Refactor player stats gui

* Refactor quick actions gui

* Refactor research milestones gui

* Refactor player bonus gui

* Refactor science production gui

* Refactor autofill gui

* Cleanup use of aligned flow

* Rename "Gui.element" to "Gui.define"

* Rename Gui types

* Rename property_from_arg

* Add guide for making guis

* Add full reference document

* Add condensed reference

* Apply style guide to refactored guis

* Bug fixes
2025-08-29 14:30:30 +01:00

74 lines
1.5 KiB
Lua

local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
local ExpUtil = require("modules/exp_util")
local concat = table.concat
local inspect = table.inspect
local pcall = pcall
local loadstring = loadstring --- @diagnostic disable-line
local rawset = rawset
local Public = {}
local inspect_process = ExpUtil.safe_value
local inspect_options = { process = inspect_process }
function Public.dump(data)
return inspect(data, inspect_options)
end
local dump = Public.dump
function Public.dump_ignore_builder(ignore)
local function process(item)
if ignore[item] then
return nil
end
return inspect_process(item)
end
local options = { process = process }
return function(data)
return inspect(data, options)
end
end
function Public.dump_function(func)
local res = { "upvalues:\n", "no longer available" }
local i = 1
--[[while true do
local n, v = debug.getupvalue(func, i)
if n == nil then
break
elseif n ~= "_ENV" then
res[#res + 1] = n
res[#res + 1] = " = "
res[#res + 1] = dump(v)
res[#res + 1] = "\n"
end
i = i + 1
end]]
return concat(res)
end
function Public.dump_text(text, player)
local func = loadstring("return " .. text)
if not func then
return false
end
local suc, var = pcall(func)
if not suc then
return false
end
return true, dump(var)
end
return Public