Update all code styles

This commit is contained in:
Cooldude2606
2024-09-28 01:56:54 +01:00
parent 5e2a62ab27
commit 292c1a1b68
194 changed files with 9817 additions and 9703 deletions

View File

@@ -30,7 +30,7 @@ local ignore = {
type = true,
xpcall = true,
_VERSION = true,
['module'] = true,
["module"] = true,
require = true,
package = true,
unpack = true,
@@ -51,31 +51,31 @@ local ignore = {
util = true,
mod_gui = true,
game = true,
rendering = true
rendering = true,
}
local header_name = Gui.uid_name()
local left_panel_name = Gui.uid_name()
local right_panel_name = Gui.uid_name()
Public.name = '_G'
Public.name = "_G"
function Public.show(container)
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
local main_flow = container.add{ type = "flow", direction = "horizontal" }
local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name}
local left_panel = main_flow.add{ type = "scroll-pane", name = left_panel_name }
local left_panel_style = left_panel.style
left_panel_style.width = 300
for key, value in pairs(_G) do
if not ignore[key] then
local header =
left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = tostring(key)}
left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = tostring(key) }
Gui.set_data(header, value)
end
end
local right_panel = main_flow.add {type = 'text-box', name = right_panel_name}
local right_panel = main_flow.add{ type = "text-box", name = right_panel_name }
right_panel.read_only = true
right_panel.selectable = true
@@ -85,7 +85,7 @@ function Public.show(container)
right_panel_style.maximal_width = 1000
right_panel_style.maximal_height = 1000
Gui.set_data(left_panel, {right_panel = right_panel, selected_header = nil})
Gui.set_data(left_panel, { right_panel = right_panel, selected_header = nil })
end
Gui.on_click(

View File

@@ -13,7 +13,7 @@ local events_to_keep = 10
-- Local vars
local Public = {
name = 'Events'
name = "Events",
}
local name_lookup = {}
@@ -28,7 +28,7 @@ local last_events = {}
storage.debug_event_view = {
enabled = enabled,
last_events = last_events,
filter = ''
filter = "",
}
function Public.on_open_debug()
@@ -42,7 +42,7 @@ function Public.on_open_debug()
storage.debug_event_view = {
enabled = enabled,
last_events = last_events
last_events = last_events,
}
end
@@ -65,7 +65,7 @@ local function event_callback(event)
last_events[name][events_to_keep + 1] = nil
event.name = nil
local str = format('%s (id = %s): %s', name, id, Model.dump(event))
local str = format("%s (id = %s): %s", name, id, Model.dump(event))
game.print(str)
log(str)
end
@@ -95,13 +95,13 @@ table.sort(grid_builder)
local function redraw_event_table(gui_table, filter)
for _, event_name in pairs(grid_builder) do
if filter == '' or event_name:find(filter) then
if filter == "" or event_name:find(filter) then
local index = events[event_name]
gui_table.add({type = 'flow'}).add {
gui_table.add{ type = "flow" }.add{
name = checkbox_name,
type = 'checkbox',
type = "checkbox",
state = enabled[index] or false,
caption = event_name
caption = event_name,
}
end
end
@@ -110,18 +110,18 @@ end
function Public.show(container)
local filter = storage.debug_event_view.filter
local main_frame_flow = container.add({type = 'flow', direction = 'vertical'})
local main_frame_flow = container.add{ type = "flow", direction = "vertical" }
local filter_flow = main_frame_flow.add({type = 'flow', direction = 'horizontal'})
filter_flow.add({type = 'label', caption = 'filter'})
local filter_textfield = filter_flow.add({type = 'textfield', name = filter_name, text = filter})
local clear_button = filter_flow.add({type = 'button', name = clear_filter_name, caption = 'clear'})
local filter_flow = main_frame_flow.add{ type = "flow", direction = "horizontal" }
filter_flow.add{ type = "label", caption = "filter" }
local filter_textfield = filter_flow.add{ type = "textfield", name = filter_name, text = filter }
local clear_button = filter_flow.add{ type = "button", name = clear_filter_name, caption = "clear" }
local scroll_pane = main_frame_flow.add({type = 'scroll-pane'})
local gui_table = scroll_pane.add({type = 'table', column_count = 3, draw_horizontal_lines = true})
local scroll_pane = main_frame_flow.add{ type = "scroll-pane" }
local gui_table = scroll_pane.add{ type = "table", column_count = 3, draw_horizontal_lines = true }
Gui.set_data(filter_textfield, gui_table)
Gui.set_data(clear_button, {gui_table = gui_table, filter_textfield = filter_textfield})
Gui.set_data(clear_button, { gui_table = gui_table, filter_textfield = filter_textfield })
redraw_event_table(gui_table, filter)
end
@@ -134,7 +134,7 @@ Gui.on_text_changed(
local element = event.element
local gui_table = Gui.get_data(element)
local filter = element.text:gsub(' ', '_')
local filter = element.text:gsub(" ", "_")
storage.debug_event_view.filter = filter
element.text = filter
@@ -152,11 +152,11 @@ Gui.on_click(
local filter_textfield = data.filter_textfield
local gui_table = data.gui_table
filter_textfield.text = ''
storage.debug_event_view.filter = ''
filter_textfield.text = ""
storage.debug_event_view.filter = ""
gui_table.clear()
redraw_event_table(gui_table, '')
redraw_event_table(gui_table, "")
end
)

View File

@@ -14,37 +14,37 @@ local right_panel_name = Gui.uid_name()
local input_text_box_name = Gui.uid_name()
local refresh_name = Gui.uid_name()
Public.name = 'Datastore'
Public.name = "Datastore"
function Public.show(container)
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
local main_flow = container.add{ type = "flow", direction = "horizontal" }
local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name}
local left_panel = main_flow.add{ type = "scroll-pane", name = left_panel_name }
local left_panel_style = left_panel.style
left_panel_style.width = 300
for name in pairs(table.keysort(Datastore.debug())) do
local header = left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = name}
local header = left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = name }
Gui.set_data(header, name)
end
local right_flow = main_flow.add {type = 'flow', direction = 'vertical'}
local right_flow = main_flow.add{ type = "flow", direction = "vertical" }
local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'}
local right_top_flow = right_flow.add{ type = "flow", direction = "horizontal" }
local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name}
local input_text_box = right_top_flow.add{ type = "text-box", name = input_text_box_name }
local input_text_box_style = input_text_box.style
input_text_box_style.horizontally_stretchable = true
input_text_box_style.height = 32
input_text_box_style.maximal_width = 1000
local refresh_button =
right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'refresh'}
right_top_flow.add{ type = "sprite-button", name = refresh_name, sprite = "utility/reset", tooltip = "refresh" }
local refresh_button_style = refresh_button.style
refresh_button_style.width = 32
refresh_button_style.height = 32
local right_panel = right_flow.add {type = 'text-box', name = right_panel_name}
local right_panel = right_flow.add{ type = "text-box", name = right_panel_name }
right_panel.read_only = true
right_panel.selectable = true
@@ -57,7 +57,7 @@ function Public.show(container)
local data = {
right_panel = right_panel,
input_text_box = input_text_box,
selected_header = nil
selected_header = nil,
}
Gui.set_data(input_text_box, data)
@@ -90,9 +90,10 @@ Gui.on_click(
local content = Datastore.debug(tableName)
local content_string = {}
for key, value in pairs(content) do
content_string[#content_string+1] = key:gsub('^%l', string.upper)..' = '..dump(value)
content_string[#content_string + 1] = key:gsub("^%l", string.upper) .. " = " .. dump(value)
end
right_panel.text = concat(content_string, '\n')
right_panel.text = concat(content_string, "\n")
end
)
@@ -100,9 +101,10 @@ local function update_dump(text_input, data)
local content = Datastore.debug(text_input.text)
local content_string = {}
for key, value in pairs(content) do
content_string[#content_string+1] = key:gsub('^%l', string.upper)..' = '..dump(value)
content_string[#content_string + 1] = key:gsub("^%l", string.upper) .. " = " .. dump(value)
end
data.right_panel.text = concat(content_string, '\n')
data.right_panel.text = concat(content_string, "\n")
end
Gui.on_text_changed(

View File

@@ -15,37 +15,37 @@ local right_panel_name = Gui.uid_name()
local input_text_box_name = Gui.uid_name()
local refresh_name = Gui.uid_name()
Public.name = 'Elements'
Public.name = "Elements"
function Public.show(container)
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
local main_flow = container.add{ type = "flow", direction = "horizontal" }
local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name}
local left_panel = main_flow.add{ type = "scroll-pane", name = left_panel_name }
local left_panel_style = left_panel.style
left_panel_style.width = 300
for element_id, file_path in pairs(ExpGui.file_paths) do
local header = left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = element_id..' - '..file_path}
local header = left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = element_id .. " - " .. file_path }
Gui.set_data(header, element_id)
end
local right_flow = main_flow.add {type = 'flow', direction = 'vertical'}
local right_flow = main_flow.add{ type = "flow", direction = "vertical" }
local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'}
local right_top_flow = right_flow.add{ type = "flow", direction = "horizontal" }
local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name}
local input_text_box = right_top_flow.add{ type = "text-box", name = input_text_box_name }
local input_text_box_style = input_text_box.style
input_text_box_style.horizontally_stretchable = true
input_text_box_style.height = 32
input_text_box_style.maximal_width = 1000
local refresh_button =
right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'refresh'}
right_top_flow.add{ type = "sprite-button", name = refresh_name, sprite = "utility/reset", tooltip = "refresh" }
local refresh_button_style = refresh_button.style
refresh_button_style.width = 32
refresh_button_style.height = 32
local right_panel = right_flow.add {type = 'text-box', name = right_panel_name}
local right_panel = right_flow.add{ type = "text-box", name = right_panel_name }
right_panel.read_only = true
right_panel.selectable = true
@@ -58,7 +58,7 @@ function Public.show(container)
local data = {
right_panel = right_panel,
input_text_box = input_text_box,
selected_header = nil
selected_header = nil,
}
Gui.set_data(input_text_box, data)
@@ -85,10 +85,10 @@ Gui.on_click(
element.style.font_color = Color.orange
data.selected_header = element
input_text_box.text = concat {'Gui.defines[', element_id, ']'}
input_text_box.text = concat{ "Gui.defines[", element_id, "]" }
input_text_box.style.font_color = Color.black
local content = dump(ExpGui.debug_info[element_id]) or 'nil'
local content = dump(ExpGui.debug_info[element_id]) or "nil"
right_panel.text = content
end
)

View File

@@ -8,7 +8,7 @@ local concat = table.concat
local Public = {}
local ignore = {tokens = true, data_store = true, datastores = true}
local ignore = { tokens = true, data_store = true, datastores = true }
local header_name = Gui.uid_name()
local left_panel_name = Gui.uid_name()
@@ -16,40 +16,40 @@ local right_panel_name = Gui.uid_name()
local input_text_box_name = Gui.uid_name()
local refresh_name = Gui.uid_name()
Public.name = 'storage'
Public.name = "storage"
function Public.show(container)
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
local main_flow = container.add{ type = "flow", direction = "horizontal" }
local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name}
local left_panel = main_flow.add{ type = "scroll-pane", name = left_panel_name }
local left_panel_style = left_panel.style
left_panel_style.width = 300
for key, _ in pairs(storage) do
if not ignore[key] then
local header =
left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = tostring(key)}
left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = tostring(key) }
Gui.set_data(header, key)
end
end
local right_flow = main_flow.add {type = 'flow', direction = 'vertical'}
local right_flow = main_flow.add{ type = "flow", direction = "vertical" }
local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'}
local right_top_flow = right_flow.add{ type = "flow", direction = "horizontal" }
local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name}
local input_text_box = right_top_flow.add{ type = "text-box", name = input_text_box_name }
local input_text_box_style = input_text_box.style
input_text_box_style.horizontally_stretchable = true
input_text_box_style.height = 32
input_text_box_style.maximal_width = 1000
local refresh_button =
right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'refresh'}
right_top_flow.add{ type = "sprite-button", name = refresh_name, sprite = "utility/reset", tooltip = "refresh" }
local refresh_button_style = refresh_button.style
refresh_button_style.width = 32
refresh_button_style.height = 32
local right_panel = right_flow.add {type = 'text-box', name = right_panel_name}
local right_panel = right_flow.add{ type = "text-box", name = right_panel_name }
right_panel.read_only = true
right_panel.selectable = true
@@ -63,7 +63,7 @@ function Public.show(container)
right_panel = right_panel,
input_text_box = input_text_box,
selected_header = nil,
selected_token_id = nil
selected_token_id = nil,
}
Gui.set_data(input_text_box, data)
@@ -90,10 +90,10 @@ Gui.on_click(
element.style.font_color = Color.orange
data.selected_header = element
input_text_box.text = concat {"storage['", key, "']"}
input_text_box.text = concat{ "storage['", key, "']" }
input_text_box.style.font_color = Color.black
local content = dump(storage[key]) or 'nil'
local content = dump(storage[key]) or "nil"
right_panel.text = content
end
)

View File

@@ -10,7 +10,7 @@ local pages = {
require("modules.exp_legacy.modules.gui.debug.global_view"),
require("modules.exp_legacy.modules.gui.debug.package_view"),
require("modules.exp_legacy.modules.gui.debug._g_view"),
require("modules.exp_legacy.modules.gui.debug.event_view")
require("modules.exp_legacy.modules.gui.debug.event_view"),
}
local main_frame_name = Gui.uid_name()
@@ -40,23 +40,23 @@ function Public.open_dubug(player)
frame.auto_center = true
]]
frame = center.add {type = 'frame', name = main_frame_name, caption = 'Debuggertron 3002', direction = 'vertical'}
frame = center.add{ type = "frame", name = main_frame_name, caption = "Debuggertron 3002", direction = "vertical" }
local frame_style = frame.style
frame_style.height = 600
frame_style.width = 900
local tab_flow = frame.add {type = 'flow', direction = 'horizontal'}
local container = frame.add {type = 'flow'}
local tab_flow = frame.add{ type = "flow", direction = "horizontal" }
local container = frame.add{ type = "flow" }
container.style.vertically_stretchable = true
local data = {}
for i = 1, #pages do
local page = pages[i]
local tab_button = tab_flow.add({type = 'flow'}).add {type = 'button', name = tab_name, caption = page.name}
local tab_button = tab_flow.add{ type = "flow" }.add{ type = "button", name = tab_name, caption = page.name }
local tab_button_style = tab_button.style
Gui.set_data(tab_button, {index = i, frame_data = data})
Gui.set_data(tab_button, { index = i, frame_data = data })
if i == 1 then
tab_button_style.font_color = Color.orange
@@ -70,7 +70,7 @@ function Public.open_dubug(player)
end
end
frame.add {type = 'button', name = close_name, caption = 'Close'}
frame.add{ type = "button", name = close_name, caption = "Close" }
end
Gui.on_click(

View File

@@ -6,72 +6,72 @@ local type = type
local concat = table.concat
local inspect = table.inspect
local pcall = pcall
local loadstring = loadstring ---@diagnostic disable-line
local loadstring = loadstring --- @diagnostic disable-line
local rawset = rawset
local Public = {}
local luaObject = {'{', nil, ", name = '", nil, "'}"}
local luaPlayer = {"{LuaPlayer, name = '", nil, "', index = ", nil, '}'}
local luaEntity = {"{LuaEntity, name = '", nil, "', unit_number = ", nil, '}'}
local luaGuiElement = {"{LuaGuiElement, name = '", nil, "'}"}
local luaObject = { "{", nil, ", name = '", nil, "'}" }
local luaPlayer = { "{LuaPlayer, name = '", nil, "', index = ", nil, "}" }
local luaEntity = { "{LuaEntity, name = '", nil, "', unit_number = ", nil, "}" }
local luaGuiElement = { "{LuaGuiElement, name = '", nil, "'}" }
local function get(obj, prop)
return obj[prop]
end
local function get_name_safe(obj)
local s, r = pcall(get, obj, 'name')
local s, r = pcall(get, obj, "name")
if not s then
return 'nil'
return "nil"
else
return r or 'nil'
return r or "nil"
end
end
local function get_lua_object_type_safe(obj)
local s, r = pcall(get, obj, 'help')
local s, r = pcall(get, obj, "help")
if not s then
return
end
return r():match('Lua%a+')
return r():match("Lua%a+")
end
local function inspect_process(item)
if type(item) ~= 'table' or type(item.__self) ~= 'userdata' then
if type(item) ~= "table" or type(item.__self) ~= "userdata" then
return item
end
local suc, valid = pcall(get, item, 'valid')
local suc, valid = pcall(get, item, "valid")
if not suc then
-- no 'valid' property
return get_lua_object_type_safe(item) or '{NoHelp LuaObject}'
return get_lua_object_type_safe(item) or "{NoHelp LuaObject}"
end
if not valid then
return '{Invalid LuaObject}'
return "{Invalid LuaObject}"
end
local obj_type = get_lua_object_type_safe(item)
if not obj_type then
return '{NoHelp LuaObject}'
return "{NoHelp LuaObject}"
end
if obj_type == 'LuaPlayer' then
luaPlayer[2] = item.name or 'nil'
luaPlayer[4] = item.index or 'nil'
if obj_type == "LuaPlayer" then
luaPlayer[2] = item.name or "nil"
luaPlayer[4] = item.index or "nil"
return concat(luaPlayer)
elseif obj_type == 'LuaEntity' then
luaEntity[2] = item.name or 'nil'
luaEntity[4] = item.unit_number or 'nil'
elseif obj_type == "LuaEntity" then
luaEntity[2] = item.name or "nil"
luaEntity[4] = item.unit_number or "nil"
return concat(luaEntity)
elseif obj_type == 'LuaGuiElement' then
elseif obj_type == "LuaGuiElement" then
local name = item.name
luaGuiElement[2] = gui_names and gui_names[name] or name or 'nil'
luaGuiElement[2] = gui_names and gui_names[name] or name or "nil"
return concat(luaGuiElement)
else
@@ -82,10 +82,11 @@ local function inspect_process(item)
end
end
local inspect_options = {process = inspect_process}
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)
@@ -97,14 +98,14 @@ function Public.dump_ignore_builder(ignore)
return inspect_process(item)
end
local options = {process = process}
local options = { process = process }
return function(data)
return inspect(data, options)
end
end
function Public.dump_function(func)
local res = {'upvalues:\n'}
local res = { "upvalues:\n" }
local i = 1
while true do
@@ -112,11 +113,11 @@ function Public.dump_function(func)
if n == nil then
break
elseif n ~= '_ENV' then
elseif n ~= "_ENV" then
res[#res + 1] = n
res[#res + 1] = ' = '
res[#res + 1] = " = "
res[#res + 1] = dump(v)
res[#res + 1] = '\n'
res[#res + 1] = "\n"
end
i = i + 1
@@ -126,16 +127,16 @@ function Public.dump_function(func)
end
function Public.dump_text(text, player)
local func = loadstring('return ' .. text)
local func = loadstring("return " .. text)
if not func then
return false
end
rawset(game, 'player', player)
rawset(game, "player", player)
local suc, var = pcall(func)
rawset(game, 'player', nil)
rawset(game, "player", nil)
if not suc then
return false

View File

@@ -17,9 +17,9 @@ local ignore = {
math = true,
debug = true,
serpent = true,
['overrides.math'] = true,
["overrides.math"] = true,
util = true,
['mod-gui'] = true
["mod-gui"] = true,
}
local file_label_name = Gui.uid_name()
@@ -29,34 +29,34 @@ local top_panel_name = Gui.uid_name()
local variable_label_name = Gui.uid_name()
local text_box_name = Gui.uid_name()
Public.name = 'package'
Public.name = "package"
function Public.show(container)
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
local main_flow = container.add{ type = "flow", direction = "horizontal" }
local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name}
local left_panel = main_flow.add{ type = "scroll-pane", name = left_panel_name }
local left_panel_style = left_panel.style
left_panel_style.width = 300
for name, file in pairs(loaded) do
if not ignore[name] then
local file_label =
left_panel.add({type = 'flow'}).add {type = 'label', name = file_label_name, caption = name}
left_panel.add{ type = "flow" }.add{ type = "label", name = file_label_name, caption = name }
Gui.set_data(file_label, file)
end
end
local right_flow = main_flow.add {type = 'flow', direction = 'vertical'}
local right_flow = main_flow.add{ type = "flow", direction = "vertical" }
local breadcrumbs = right_flow.add {type = 'label', name = breadcrumbs_name}
local breadcrumbs = right_flow.add{ type = "label", name = breadcrumbs_name }
local top_panel = right_flow.add {type = 'scroll-pane', name = top_panel_name}
local top_panel = right_flow.add{ type = "scroll-pane", name = top_panel_name }
local top_panel_style = top_panel.style
top_panel_style.height = 200
top_panel_style.maximal_width = 1000
top_panel_style.horizontally_stretchable = true
local text_box = right_flow.add {type = 'text-box', name = text_box_name}
local text_box = right_flow.add{ type = "text-box", name = text_box_name }
text_box.read_only = true
text_box.selectable = true
@@ -72,7 +72,7 @@ function Public.show(container)
top_panel = top_panel,
text_box = text_box,
selected_file_label = nil,
selected_variable_label = nil
selected_variable_label = nil,
}
Gui.set_data(left_panel, data)
@@ -104,13 +104,13 @@ Gui.on_click(
local file_type = type(file)
if file_type == 'table' then
if file_type == "table" then
for k, v in pairs(file) do
local label =
top_panel.add({type = 'flow'}).add {type = 'label', name = variable_label_name, caption = k}
top_panel.add{ type = "flow" }.add{ type = "label", name = variable_label_name, caption = k }
Gui.set_data(label, v)
end
elseif file_type == 'function' then
elseif file_type == "function" then
text_box.text = dump_function(file)
else
text_box.text = tostring(file)
@@ -130,13 +130,14 @@ Gui.on_click(
local variable_type = type(variable)
if variable_type == 'table' then
if variable_type == "table" then
Gui.clear(top_panel)
for k, v in pairs(variable) do
local label =
top_panel.add({type = 'flow'}).add {type = 'label', name = variable_label_name, caption = k}
top_panel.add{ type = "flow" }.add{ type = "label", name = variable_label_name, caption = k }
Gui.set_data(label, v)
end
return
end
@@ -149,7 +150,7 @@ Gui.on_click(
element.style.font_color = Color.orange
data.selected_variable_label = element
if variable_type == 'function' then
if variable_type == "function" then
text_box.text = dump_function(variable)
else
text_box.text = tostring(variable)

View File

@@ -15,37 +15,37 @@ local right_panel_name = Gui.uid_name()
local input_text_box_name = Gui.uid_name()
local refresh_name = Gui.uid_name()
Public.name = 'Storage'
Public.name = "Storage"
function Public.show(container)
local main_flow = container.add {type = 'flow', direction = 'horizontal'}
local main_flow = container.add{ type = "flow", direction = "horizontal" }
local left_panel = main_flow.add {type = 'scroll-pane', name = left_panel_name}
local left_panel = main_flow.add{ type = "scroll-pane", name = left_panel_name }
local left_panel_style = left_panel.style
left_panel_style.width = 300
for token_id in pairs(Storage.registered) do
local header = left_panel.add({type = 'flow'}).add {type = 'label', name = header_name, caption = token_id}
local header = left_panel.add{ type = "flow" }.add{ type = "label", name = header_name, caption = token_id }
Gui.set_data(header, token_id)
end
local right_flow = main_flow.add {type = 'flow', direction = 'vertical'}
local right_flow = main_flow.add{ type = "flow", direction = "vertical" }
local right_top_flow = right_flow.add {type = 'flow', direction = 'horizontal'}
local right_top_flow = right_flow.add{ type = "flow", direction = "horizontal" }
local input_text_box = right_top_flow.add {type = 'text-box', name = input_text_box_name}
local input_text_box = right_top_flow.add{ type = "text-box", name = input_text_box_name }
local input_text_box_style = input_text_box.style
input_text_box_style.horizontally_stretchable = true
input_text_box_style.height = 32
input_text_box_style.maximal_width = 1000
local refresh_button =
right_top_flow.add {type = 'sprite-button', name = refresh_name, sprite = 'utility/reset', tooltip = 'refresh'}
right_top_flow.add{ type = "sprite-button", name = refresh_name, sprite = "utility/reset", tooltip = "refresh" }
local refresh_button_style = refresh_button.style
refresh_button_style.width = 32
refresh_button_style.height = 32
local right_panel = right_flow.add {type = 'text-box', name = right_panel_name}
local right_panel = right_flow.add{ type = "text-box", name = right_panel_name }
right_panel.read_only = true
right_panel.selectable = true
@@ -58,7 +58,7 @@ function Public.show(container)
local data = {
right_panel = right_panel,
input_text_box = input_text_box,
selected_header = nil
selected_header = nil,
}
Gui.set_data(input_text_box, data)
@@ -85,10 +85,10 @@ Gui.on_click(
element.style.font_color = Color.orange
data.selected_header = element
input_text_box.text = concat {'storage.exp_storage[', token_id, ']'}
input_text_box.text = concat{ "storage.exp_storage[", token_id, "]" }
input_text_box.style.font_color = Color.black
local content = dump(storage.exp_storage[token_id]) or 'nil'
local content = dump(storage.exp_storage[token_id]) or "nil"
right_panel.text = content
end
)