diff --git a/docs/addons/Advanced-Start.html b/docs/addons/Advanced-Start.html index 7eff9ff1..17a11fd8 100644 --- a/docs/addons/Advanced-Start.html +++ b/docs/addons/Advanced-Start.html @@ -70,12 +70,10 @@ - - @@ -350,7 +348,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Popups.html b/docs/addons/Chat-Popups.html index b7f62e7a..ec447b0d 100644 --- a/docs/addons/Chat-Popups.html +++ b/docs/addons/Chat-Popups.html @@ -70,12 +70,10 @@ - - @@ -351,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Chat-Reply.html b/docs/addons/Chat-Reply.html index 461b1085..227a2701 100644 --- a/docs/addons/Chat-Reply.html +++ b/docs/addons/Chat-Reply.html @@ -70,12 +70,10 @@ - - @@ -378,7 +376,7 @@ generated by LDoc diff --git a/docs/addons/Compilatron.html b/docs/addons/Compilatron.html index 69e05991..dc49b78b 100644 --- a/docs/addons/Compilatron.html +++ b/docs/addons/Compilatron.html @@ -71,12 +71,10 @@ - - @@ -587,7 +585,7 @@ generated by LDoc diff --git a/docs/addons/Damage-Popups.html b/docs/addons/Damage-Popups.html index b23f36ff..c5d5f078 100644 --- a/docs/addons/Damage-Popups.html +++ b/docs/addons/Damage-Popups.html @@ -70,12 +70,10 @@ - - @@ -351,7 +349,7 @@ generated by LDoc diff --git a/docs/addons/Death-Logger.html b/docs/addons/Death-Logger.html index 970986a7..71cc9bde 100644 --- a/docs/addons/Death-Logger.html +++ b/docs/addons/Death-Logger.html @@ -70,12 +70,10 @@ - - @@ -406,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Discord-Alerts.html b/docs/addons/Discord-Alerts.html index ce786d86..27d0af48 100644 --- a/docs/addons/Discord-Alerts.html +++ b/docs/addons/Discord-Alerts.html @@ -70,12 +70,10 @@ - - @@ -462,7 +460,7 @@ generated by LDoc diff --git a/docs/addons/Player-Colours.html b/docs/addons/Player-Colours.html index be4036df..7d67adeb 100644 --- a/docs/addons/Player-Colours.html +++ b/docs/addons/Player-Colours.html @@ -70,12 +70,10 @@ - - @@ -406,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Pollution-Grading.html b/docs/addons/Pollution-Grading.html index 9c0a334d..d488a111 100644 --- a/docs/addons/Pollution-Grading.html +++ b/docs/addons/Pollution-Grading.html @@ -70,12 +70,10 @@ - - @@ -322,7 +320,7 @@ generated by LDoc diff --git a/docs/addons/Scorched-Earth.html b/docs/addons/Scorched-Earth.html index 69be957b..55bea826 100644 --- a/docs/addons/Scorched-Earth.html +++ b/docs/addons/Scorched-Earth.html @@ -70,12 +70,10 @@ - - @@ -406,7 +404,7 @@ generated by LDoc diff --git a/docs/addons/Spawn-Area.html b/docs/addons/Spawn-Area.html index 7be892ff..13dfba39 100644 --- a/docs/addons/Spawn-Area.html +++ b/docs/addons/Spawn-Area.html @@ -70,12 +70,10 @@ - - @@ -378,7 +376,7 @@ generated by LDoc diff --git a/docs/commands/Admin-Chat.html b/docs/commands/Admin-Chat.html index 59344610..731be00d 100644 --- a/docs/commands/Admin-Chat.html +++ b/docs/commands/Admin-Chat.html @@ -80,12 +80,10 @@ - - @@ -390,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Bonus.html b/docs/commands/Bonus.html index fc584a2e..d49279c2 100644 --- a/docs/commands/Bonus.html +++ b/docs/commands/Bonus.html @@ -80,12 +80,10 @@ - - @@ -502,7 +500,7 @@ generated by LDoc diff --git a/docs/commands/Cheat-Mode.html b/docs/commands/Cheat-Mode.html index 7bafc60e..accc40eb 100644 --- a/docs/commands/Cheat-Mode.html +++ b/docs/commands/Cheat-Mode.html @@ -80,12 +80,10 @@ - - @@ -363,7 +361,7 @@ generated by LDoc diff --git a/docs/commands/Clear-Inventory.html b/docs/commands/Clear-Inventory.html index bf601ad5..e20883e3 100644 --- a/docs/commands/Clear-Inventory.html +++ b/docs/commands/Clear-Inventory.html @@ -80,12 +80,10 @@ - - @@ -390,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Debug.html b/docs/commands/Debug.html index 532efa99..af847b74 100644 --- a/docs/commands/Debug.html +++ b/docs/commands/Debug.html @@ -80,12 +80,10 @@ - - @@ -367,7 +365,7 @@ generated by LDoc diff --git a/docs/commands/Find.html b/docs/commands/Find.html index 17fec9b6..fc61f8cf 100644 --- a/docs/commands/Find.html +++ b/docs/commands/Find.html @@ -80,12 +80,10 @@ - - @@ -362,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Help.html b/docs/commands/Help.html index 0122b470..c5d73042 100644 --- a/docs/commands/Help.html +++ b/docs/commands/Help.html @@ -80,12 +80,10 @@ - - @@ -406,7 +404,7 @@ generated by LDoc diff --git a/docs/commands/Home.html b/docs/commands/Home.html index 793b64f4..05da9559 100644 --- a/docs/commands/Home.html +++ b/docs/commands/Home.html @@ -80,12 +80,10 @@ - - @@ -460,7 +458,7 @@ generated by LDoc diff --git a/docs/commands/Interface.html b/docs/commands/Interface.html index 1e467b7b..bc2e0590 100644 --- a/docs/commands/Interface.html +++ b/docs/commands/Interface.html @@ -80,12 +80,10 @@ - - @@ -418,7 +416,7 @@ generated by LDoc diff --git a/docs/commands/Jail.html b/docs/commands/Jail.html index 238e0248..6ff4802e 100644 --- a/docs/commands/Jail.html +++ b/docs/commands/Jail.html @@ -80,12 +80,10 @@ - - @@ -613,7 +611,7 @@ generated by LDoc diff --git a/docs/commands/Kill.html b/docs/commands/Kill.html index 2f3a42d3..a16c18b0 100644 --- a/docs/commands/Kill.html +++ b/docs/commands/Kill.html @@ -80,12 +80,10 @@ - - @@ -391,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Me.html b/docs/commands/Me.html index 24b64a87..2f8cb3f4 100644 --- a/docs/commands/Me.html +++ b/docs/commands/Me.html @@ -80,12 +80,10 @@ - - @@ -362,7 +360,7 @@ generated by LDoc diff --git a/docs/commands/Rainbow.html b/docs/commands/Rainbow.html index d921f1ef..83127954 100644 --- a/docs/commands/Rainbow.html +++ b/docs/commands/Rainbow.html @@ -80,12 +80,10 @@ - - @@ -390,7 +388,7 @@ generated by LDoc diff --git a/docs/commands/Repair.html b/docs/commands/Repair.html index b6f8113b..dfc8fde0 100644 --- a/docs/commands/Repair.html +++ b/docs/commands/Repair.html @@ -79,12 +79,10 @@ - - @@ -323,7 +321,7 @@ generated by LDoc diff --git a/docs/commands/Reports.html b/docs/commands/Reports.html index d51b8af1..bb852d95 100644 --- a/docs/commands/Reports.html +++ b/docs/commands/Reports.html @@ -80,12 +80,10 @@ - - @@ -587,7 +585,7 @@ generated by LDoc diff --git a/docs/commands/Roles.html b/docs/commands/Roles.html index acf6971f..338a0c5e 100644 --- a/docs/commands/Roles.html +++ b/docs/commands/Roles.html @@ -80,12 +80,10 @@ - - @@ -559,7 +557,7 @@ generated by LDoc diff --git a/docs/commands/Spawn.html b/docs/commands/Spawn.html index a940c112..9eba8a8f 100644 --- a/docs/commands/Spawn.html +++ b/docs/commands/Spawn.html @@ -80,12 +80,10 @@ - - @@ -391,7 +389,7 @@ generated by LDoc diff --git a/docs/commands/Tag.html b/docs/commands/Tag.html index bafc6f14..b8609e4a 100644 --- a/docs/commands/Tag.html +++ b/docs/commands/Tag.html @@ -80,12 +80,10 @@ - - @@ -445,7 +443,7 @@ generated by LDoc diff --git a/docs/commands/Teleport.html b/docs/commands/Teleport.html index 2afdbc08..eeed3aa0 100644 --- a/docs/commands/Teleport.html +++ b/docs/commands/Teleport.html @@ -80,12 +80,10 @@ - - @@ -486,7 +484,7 @@ generated by LDoc diff --git a/docs/commands/Warnings.html b/docs/commands/Warnings.html index adabade7..337f8b93 100644 --- a/docs/commands/Warnings.html +++ b/docs/commands/Warnings.html @@ -80,12 +80,10 @@ - - @@ -571,7 +569,7 @@ generated by LDoc diff --git a/docs/configs/Advanced-Start.html b/docs/configs/Advanced-Start.html index 3f5c06a8..72c02f54 100644 --- a/docs/configs/Advanced-Start.html +++ b/docs/configs/Advanced-Start.html @@ -85,12 +85,10 @@ - - @@ -508,7 +506,7 @@ generated by LDoc diff --git a/docs/configs/Bonuses.html b/docs/configs/Bonuses.html index e04bc9e6..31d8e33c 100644 --- a/docs/configs/Bonuses.html +++ b/docs/configs/Bonuses.html @@ -77,12 +77,10 @@ - - @@ -239,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/Chat-Reply.html b/docs/configs/Chat-Reply.html index 17898132..da119978 100644 --- a/docs/configs/Chat-Reply.html +++ b/docs/configs/Chat-Reply.html @@ -86,12 +86,10 @@ - - @@ -487,7 +485,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Admin.html b/docs/configs/Commands-Auth-Admin.html index e9d41e16..fa578e05 100644 --- a/docs/configs/Commands-Auth-Admin.html +++ b/docs/configs/Commands-Auth-Admin.html @@ -85,12 +85,10 @@ - - @@ -296,7 +294,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Roles.html b/docs/configs/Commands-Auth-Roles.html index ed8de360..2e83f8aa 100644 --- a/docs/configs/Commands-Auth-Roles.html +++ b/docs/configs/Commands-Auth-Roles.html @@ -85,12 +85,10 @@ - - @@ -322,7 +320,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Auth-Runtime-Disable.html b/docs/configs/Commands-Auth-Runtime-Disable.html index b74be123..e908fa8c 100644 --- a/docs/configs/Commands-Auth-Runtime-Disable.html +++ b/docs/configs/Commands-Auth-Runtime-Disable.html @@ -86,12 +86,10 @@ - - @@ -444,7 +442,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse-Roles.html b/docs/configs/Commands-Parse-Roles.html index 3cd75126..3206b122 100644 --- a/docs/configs/Commands-Parse-Roles.html +++ b/docs/configs/Commands-Parse-Roles.html @@ -85,12 +85,10 @@ - - @@ -356,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Commands-Parse.html b/docs/configs/Commands-Parse.html index 454432dc..14f65272 100644 --- a/docs/configs/Commands-Parse.html +++ b/docs/configs/Commands-Parse.html @@ -85,12 +85,10 @@ - - @@ -340,7 +338,7 @@ see ./expcore/commands.lua for more details

generated by LDoc diff --git a/docs/configs/Compilatron.html b/docs/configs/Compilatron.html index 7f9f5bae..2d0f47b4 100644 --- a/docs/configs/Compilatron.html +++ b/docs/configs/Compilatron.html @@ -85,12 +85,10 @@ - - @@ -356,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Death-Logger.html b/docs/configs/Death-Logger.html index 3df18979..f03d13cd 100644 --- a/docs/configs/Death-Logger.html +++ b/docs/configs/Death-Logger.html @@ -85,12 +85,10 @@ - - @@ -418,7 +416,7 @@ generated by LDoc diff --git a/docs/configs/Discord-Alerts.html b/docs/configs/Discord-Alerts.html index 307fba0d..e7cc6d8b 100644 --- a/docs/configs/Discord-Alerts.html +++ b/docs/configs/Discord-Alerts.html @@ -77,12 +77,10 @@ - - @@ -239,7 +237,7 @@ generated by LDoc diff --git a/docs/configs/File-Loader.html b/docs/configs/File-Loader.html index 8dd2e4d2..25d76c3b 100644 --- a/docs/configs/File-Loader.html +++ b/docs/configs/File-Loader.html @@ -77,12 +77,10 @@ - - @@ -242,7 +240,7 @@ generated by LDoc diff --git a/docs/configs/Permission-Groups.html b/docs/configs/Permission-Groups.html index c748144f..5798d322 100644 --- a/docs/configs/Permission-Groups.html +++ b/docs/configs/Permission-Groups.html @@ -85,12 +85,10 @@ - - @@ -297,7 +295,7 @@ generated by LDoc diff --git a/docs/configs/Player-List.html b/docs/configs/Player-List.html index f416997b..28764dd5 100644 --- a/docs/configs/Player-List.html +++ b/docs/configs/Player-List.html @@ -86,12 +86,10 @@ - - @@ -814,7 +812,7 @@ generated by LDoc diff --git a/docs/configs/Pollution-Grading.html b/docs/configs/Pollution-Grading.html index bd47979f..3f407af5 100644 --- a/docs/configs/Pollution-Grading.html +++ b/docs/configs/Pollution-Grading.html @@ -85,12 +85,10 @@ - - @@ -386,7 +384,7 @@ generated by LDoc diff --git a/docs/configs/Popup-Messages.html b/docs/configs/Popup-Messages.html index 8f84f684..e217cb89 100644 --- a/docs/configs/Popup-Messages.html +++ b/docs/configs/Popup-Messages.html @@ -85,12 +85,10 @@ - - @@ -416,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Preset-Player-Colours.html b/docs/configs/Preset-Player-Colours.html index e49269ee..6ded0dd1 100644 --- a/docs/configs/Preset-Player-Colours.html +++ b/docs/configs/Preset-Player-Colours.html @@ -85,12 +85,10 @@ - - @@ -326,7 +324,7 @@ generated by LDoc diff --git a/docs/configs/Repair.html b/docs/configs/Repair.html index ff7b2189..04430dd7 100644 --- a/docs/configs/Repair.html +++ b/docs/configs/Repair.html @@ -85,12 +85,10 @@ - - @@ -416,7 +414,7 @@ generated by LDoc diff --git a/docs/configs/Rockets.html b/docs/configs/Rockets.html index 15088476..2a142796 100644 --- a/docs/configs/Rockets.html +++ b/docs/configs/Rockets.html @@ -85,12 +85,10 @@ - - @@ -836,7 +834,7 @@ generated by LDoc diff --git a/docs/configs/Roles.html b/docs/configs/Roles.html index 6cc0063b..3fbacb0e 100644 --- a/docs/configs/Roles.html +++ b/docs/configs/Roles.html @@ -85,12 +85,10 @@ - - @@ -294,7 +292,7 @@ generated by LDoc diff --git a/docs/configs/Science.html b/docs/configs/Science.html index a85612a6..873dbf53 100644 --- a/docs/configs/Science.html +++ b/docs/configs/Science.html @@ -85,12 +85,10 @@ - - @@ -356,7 +354,7 @@ generated by LDoc diff --git a/docs/configs/Scorched-Earth.html b/docs/configs/Scorched-Earth.html index f9888961..5f2f2131 100644 --- a/docs/configs/Scorched-Earth.html +++ b/docs/configs/Scorched-Earth.html @@ -85,12 +85,10 @@ - - @@ -390,7 +388,7 @@ generated by LDoc diff --git a/docs/configs/Spawn-Area.html b/docs/configs/Spawn-Area.html index fec2403b..ebefadb6 100644 --- a/docs/configs/Spawn-Area.html +++ b/docs/configs/Spawn-Area.html @@ -85,12 +85,10 @@ - - @@ -746,7 +744,7 @@ generated by LDoc diff --git a/docs/configs/Tasks.html b/docs/configs/Tasks.html index 43bdb919..2ea51a33 100644 --- a/docs/configs/Tasks.html +++ b/docs/configs/Tasks.html @@ -85,12 +85,10 @@ - - @@ -386,7 +384,7 @@ generated by LDoc diff --git a/docs/configs/Warnings.html b/docs/configs/Warnings.html index d5b14073..1971da7d 100644 --- a/docs/configs/Warnings.html +++ b/docs/configs/Warnings.html @@ -85,12 +85,10 @@ - - @@ -357,7 +355,7 @@ generated by LDoc diff --git a/docs/configs/Warps.html b/docs/configs/Warps.html index 3fb7f77f..c90c3b4f 100644 --- a/docs/configs/Warps.html +++ b/docs/configs/Warps.html @@ -85,12 +85,10 @@ - - @@ -686,7 +684,7 @@ generated by LDoc diff --git a/docs/control/Jail.html b/docs/control/Jail.html index a6acc5ce..8b2073fa 100644 --- a/docs/control/Jail.html +++ b/docs/control/Jail.html @@ -69,12 +69,10 @@ - - @@ -1210,7 +1208,7 @@ generated by LDoc diff --git a/docs/control/Production.html b/docs/control/Production.html index 53874e4d..cfc5135f 100644 --- a/docs/control/Production.html +++ b/docs/control/Production.html @@ -69,12 +69,10 @@ - - @@ -1331,7 +1329,7 @@ generated by LDoc diff --git a/docs/control/Reports.html b/docs/control/Reports.html index 67fb2864..02a29320 100644 --- a/docs/control/Reports.html +++ b/docs/control/Reports.html @@ -69,12 +69,10 @@ - - @@ -1112,7 +1110,7 @@ generated by LDoc diff --git a/docs/control/Rockets.html b/docs/control/Rockets.html index 4d560f6f..4cd079d7 100644 --- a/docs/control/Rockets.html +++ b/docs/control/Rockets.html @@ -68,12 +68,10 @@ - - @@ -986,7 +984,7 @@ generated by LDoc diff --git a/docs/control/Tasks.html b/docs/control/Tasks.html index f37fc0d6..0a82275c 100644 --- a/docs/control/Tasks.html +++ b/docs/control/Tasks.html @@ -68,12 +68,10 @@ - - @@ -1041,7 +1039,7 @@ generated by LDoc diff --git a/docs/control/Warnings.html b/docs/control/Warnings.html index 38998a09..cca92779 100644 --- a/docs/control/Warnings.html +++ b/docs/control/Warnings.html @@ -68,12 +68,10 @@ - - @@ -1467,7 +1465,7 @@ generated by LDoc diff --git a/docs/control/Warps.html b/docs/control/Warps.html index fca4cb74..4af6171d 100644 --- a/docs/control/Warps.html +++ b/docs/control/Warps.html @@ -69,12 +69,10 @@ - - @@ -1415,7 +1413,7 @@ generated by LDoc diff --git a/docs/core/Commands.html b/docs/core/Commands.html index 590f6080..b6e82a2c 100644 --- a/docs/core/Commands.html +++ b/docs/core/Commands.html @@ -57,12 +57,10 @@ - - @@ -1974,7 +1972,7 @@ generated by LDoc diff --git a/docs/core/Common-Library.html b/docs/core/Common-Library.html index 6f6e5c02..ee9e8780 100644 --- a/docs/core/Common-Library.html +++ b/docs/core/Common-Library.html @@ -53,12 +53,10 @@ - - @@ -2748,7 +2746,7 @@ Common.table_insert(tbl,50,tbl2) generated by LDoc diff --git a/docs/core/Gui.html b/docs/core/Gui.html index 9524e47e..6533ff0e 100644 --- a/docs/core/Gui.html +++ b/docs/core/Gui.html @@ -41,17 +41,22 @@ @@ -62,12 +67,10 @@ - - @@ -213,17 +216,22 @@ @@ -243,7 +251,11 @@

Gui core

-

Core Module - Gui

+

Core Module - Gui + - This file is used to require all the different elements of the gui module + - each module has an outline here but for more details see their separate files in ./gui + - please read the files for more documentation that cant be shown here + - please note there is a rework planned but not started

@@ -251,69 +263,6 @@ -

Usage

-
-- Making the base button concept
-local button =
-Gui.new_concept() -- Make a new empty concept
-:save_as('button') -- Save it as Gui.concepts.button so it can be used in other files
-:new_event('on_click',defines.events.on_gui_click) -- Add an on click event for this concept
-:new_property('tooltip') -- Add a property with the default setter method called tooltip
-:new_property('caption',function(properties,value) -- Add a property with a custom setter method called caption
-    properties.caption = value
-    properties.sprite = nil
-    properties.type = 'button'
-end)
-:new_property('sprite',function(properties,value) -- Add a property with a custom setter method called sprite
-    properties.image = value
-    properties.caption = nil
-    properties.type = 'sprite-button'
-end)
-:define_draw(function(properties,parent,element) -- Add the draw function to create the element from the concept
-    -- Properties will include all the information that you need to draw the element
-    -- Parent is the parent element for the element, this may have been altered by previous draw functions
-    -- Element is the current element being made, this may have a nil value, if it is nil then this is the first draw function
-    if properties.type == 'button' then
-        element = parent.add{
-            type = properties.type,
-            name = properties.name,
-            caption = properties.caption,
-            tooltip = properties.tooltip
-        }
-
-    else
-        element = parent.add{
-            type = properties.type,
-            name = properties.name,
-            sprite = properties.sprite,
-            tooltip = properties.tooltip
-        }
-
-    end
-
-    -- If you return element or parent then their values will be updated for the next draw function in the chain
-    -- It is best practice to always return the values if you have made any changes to them
-    return element, parent
-end)
-
-- Making a new button which has a custom style
-local custom_button =
-Gui.new_concept('button') -- We can use button here since we used save as on the concept
--- button:clone() -- If we had not used save as then this is how we would use it as a base
-:set_caption('Custom Button') -- Set the caption of the concept, this is possible as we added caption as a property
-:set_tooltip('Only admins can press this button') -- Set the tooltip of the concept, this is possible as we added tooltip as a property
-:on_click(function(event) -- Register a handler to the click event we added with new event
-    if not event.player.admin then
-        event.player.print('You must be admin to use this button')
-    end
-end)
-:new_event('on_admin_clicked',defines.events.on_gui_click,function(event) -- Add a click event which has a filter function
-    return event.player.admin -- Check if the player is admin
-end)
-:on_admin_clicked(function(event) -- Register a handler to the admin click event we have just created
-    -- The admin click event is only an example, because of how sinmple the filter is we could have just used an if else statement
-    game.print(event.player.name..' pressed my admin button')
-end)
-
-- Drawing a concept
-custom_button:draw(game.player.gui.left)
@@ -321,69 +270,461 @@ Gui.new_concept('button') -- W -

Elements

+

Dependencies

- - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + + + +
buttonClickable elements that fire on_gui_click when clicked.expcore.gui.core
checkboxClickable elements with a cross in the middle that can be turned off or on.expcore.gui.instances
dropdownA drop down list of other elements.expcore.gui.elements.buttons
elem_buttonA button that lets the player pick one of an: item, entity, tile, or signal similar to the filter-select window.expcore.gui.elements.checkbox
emptyA empty widget that just exists.expcore.gui.elements.dropdown
flowInvisible containers that lay out children either horizontally or vertically.expcore.gui.elements.slider
frameGrey semi-transparent boxes that contain other elements.expcore.gui.elements.text
labelA piece of text.expcore.gui.elements.elem-button
lineA vertical or horizontal line.expcore.gui.elements.progress-bar
progress_barIndicate progress by displaying a partially filled bar.expcore.gui.concepts.toolbar
scrollSimilar to a flow but includes the ability to show and use scroll bars.expcore.gui.concepts.left
sliderA number picker.expcore.gui.concepts.center
tableAn invisible container that lays out children in a specific number of columns.expcore.gui.concepts.popups
+ + +

Center Guis

+ + + + + - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
text_boxA multi-line text box that supports selection and copy-paste.expcore.gui.prototype
text_fieldBoxes of text the user can type in.expcore.gui.concepts.toolbar
utils.game
CenterFrames.get_flow(player)Gets the center flow for a player
CenterFrames.clear_flow(player)Clears the center flow for a player
CenterFrames.draw_frame(player, name)Draws the center frame for a player, if already open then will do nothing
CenterFrames.redraw_frame(player, name)Draws the center frame for a player, if already open then will destroy it and redraw
CenterFrames.toggle_frame(player, name[, state])Toggles if the frame is currently open or not, will open if closed and close if open
CenterFrames.new_frame(permission_name)Creates a new center frame define
CenterFrames._prototype:set_auto_focus([state=true])Sets the frame to be the current active gui when opened and closes all other frames
CenterFrames._prototype:draw_frame(player)Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)
CenterFrames._prototype:redraw_frame(player)Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)
CenterFrames._prototype:toggle_frame(player)Toggles if the frame is open, if open it will close it and if closed it will open it
CenterFrames._prototype:event_handler([action=update])Creates an event handler that will trigger one of its functions, use with Event.add
+ + +

Left Guis

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.gui.concepts.toolbar
expcore.gui.elements.buttons
mod-gui
utils.game
utils.event
LeftFrames.get_flow(player)Gets the left frame flow for a player
LeftFrames.get_frame(name, player)Gets one frame from the left flow by its name
LeftFrames.get_open(player)Gets all open frames for a player, if non are open it will remove the close all button
LeftFrames.toggle_frame(name, player[, state])Toggles the visibility of a left frame, or sets its visibility state
LeftFrames.new_frame(permission_name)Creates a new left frame define
LeftFrames._prototype:set_open_by_default([state=true])Sets if the frame is visible when a player joins, can also be a function to return a boolean
LeftFrames._prototype:set_direction(direction)Sets the direction of the frame, either vertical or horizontal
LeftFrames._prototype:_internal_draw(player)Creates the gui for the first time, used internally
LeftFrames._prototype:get_frame(player)Gets the frame for this define from the left frame flow
LeftFrames._prototype:is_open(player)Returns if the player currently has this define visible
LeftFrames._prototype:toggle(player)Toggles the visibility of the left frame
LeftFrames._prototype:update(player)Updates the contents of the left frame, first tries update callback, other wise will clear and redraw
LeftFrames._prototype:update_all([update_offline=false])Updates the frame for all players, see update
LeftFrames._prototype:redraw(player)Redraws the frame by calling on_draw, will always clear the frame
LeftFrames._prototype:redraw_all([update_offline=false])Redraws the frame for all players, see redraw
LeftFrames._prototype:event_handler([action=update])Creates an event handler that will trigger one of its functions, use with Event.add
+ + +

Popups

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
utils.event
expcore.gui.elements.progress-bar
expcore.gui.elements.buttons
mod-gui
resources.color_presets
utils.global
PopupFrames.get_flow(player)Gets the left flow that contains the popup frames
PopupFrames.open(define_name, player[, open_time], ...)Opens a popup for the player, can give the amount of time it is open as well as params for the draw function
PopupFrames.close_progressProgress bar which when depleted will close the popup frame
PopupFrames.close_buttonA button which can be used to close the gui before the timer runs out
PopupFrames.new_popup([name])Creates a new popup frame define
PopupFrames._prototype:set_default_open_time(amount)Sets the default open time for the popup, will be used if non is provided with open
PopupFrames._prototype:open(player[, open_time], ...)Opens this define for a player, can be given open time and any other params for the draw function
+ + +

Toolbar

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.elements.buttons
expcore.roles
utils.event
utils.game
mod-gui
Toolbar.new_button([name])Adds a new button to the toolbar
Toolbar.add_button(button)Adds an existing buttton to the toolbar
Toolbar.update(player)Updates the player's toolbar with an new buttons or expected change in auth return
+ + +

Core

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
utils.gui
utils.game
new_define(prototype[, debug_name])Used to create new element defines from a class prototype, please use the own given by the class
get_define(name[, internal])Gets an element define give the uid, debug name or a copy of the element define
categorize_by_player(element)A categorize function to be used with add_store, each player has their own value
categorize_by_force(element)A categorize function to be used with add_store, each force has its own value
categorize_by_surface(element)A categorize function to be used with add_store, each surface has its own value
draw(name, element)Draws a copy of the element define to the parent element, see draw_to
toggle_enabled(element)Will toggle the enabled state of an element
toggle_visible(element)Will toggle the visiblity of an element
set_padding(element[, up=0][, down=0][, left=0][, right=0])Sets the padding for a gui element
set_padding_style(style[, up=0][, down=0][, left=0][, right=0])Sets the padding for a gui style
create_alignment(element[, name][, horizontal_align='right'][, vertical_align='center'])Allows the creation of an alignment flow to place elements into
destroy_if_valid(element)Destroies an element but tests for it being present and valid first
create_scroll_table(element, table_size, maximal_height[, name='scroll'])Creates a scroll area with a table inside, table can be any size
create_header(element, caption[, tooltip][, right_align][, name='header'])Creates a header section with a label and button area
+ + +

Buttons

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mod-gui
expcore.gui.core
expcore.gui.prototype
Button.new_button([name])Creates a new button element define
Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite])Adds sprites to a button making it a sprite button
Button._prototype:set_click_filter(filter[, ...])Adds a click / mouse button filter to the button
Button._prototype:set_key_filter(filter[, ...])Adds a control key filter to the button
+ + +

Checkboxs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
expcore.store
utils.game
Checkbox.new_checkbox([name])Creates a new checkbox element define
Checkbox.new_radiobutton([name])Creates a new radiobutton element define, has all functions checkbox has
Checkbox._prototype_radiobutton:add_as_option(option_set, option_name)Adds this radiobutton to be an option in the given option set (only one can be true at a time)
Checkbox._prototype_radiobutton:get_store(category, internal)Gets the stored value of the radiobutton or the option set if present
Checkbox._prototype_radiobutton:set_store(category, value, internal)Sets the stored value of the radiobutton or the option set if present
Checkbox.new_option_set(name, callback, categorize)Registers a new option set that can be linked to radiobuttons (only one can be true at a time)
Checkbox.draw_option_set(name, element)Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)
Checkbox.reset_radiobuttons(element[, exclude][, recursive=false])Sets all radiobutton in a element to false (unless excluded) and can act recursively
@@ -394,16 +735,70 @@ Gui.new_concept('button') -- W - set_dropdown_value(element, value) - Selects the index of a dropdown with this value + expcore.gui.core - get_dropdown_value(element) - Gets the selected item value of a dropdown + expcore.gui.prototype - add_dropdown_items(element[, start_index], new_items) - Adds the given items into the list of items for this dropdown + utils.game + + + Dropdown.new_dropdown([name]) + Creates a new dropdown element define + + + Dropdown.new_list_box([name]) + Creates a new list box element define + + + Dropdown._prototype:new_static_options(options[, ...], the) + Adds new static options to the dropdown which will trigger the general callback + + + Dropdown._prototype:new_dynamic_options(callback) + Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options) + + + Dropdown._prototype:add_option_callback(option, callback) + Adds a case specific callback which will only run when that option is selected (general case still triggered) + + + Dropdown.select_value(element, value) + Selects the option from a dropdown or list box given the value rather than key + + + Dropdown.get_selected_value(element) + Returns the currently selected value rather than index + + + + + +

Elem Buttons

+ + + + + + + + + + + + + + + + + + + + + + +
expcore.gui.core
expcore.gui.prototype
utils.game
ElemButton.new_elem_button([name])Creates a new elem button element define
ElemButton._prototype.set_typeSets the type of the elem button, the type is required so this must be called at least once
ElemButton._prototype:set_default(value)Sets the default value for the elem button, this may be a function or a string
@@ -414,248 +809,306 @@ Gui.new_concept('button') -- W - progress_bar:increment(element[, amount=1]) - Will increase the progress of a progress bar based on this concept, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances + expcore.gui.core - progress_bar:decrement(element[, amount=1]) - Will decrease the progress of a progress bar based on this concept, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances + expcore.gui.prototype - progress_bar:reset(element) - Resets the progress back to 0% for this element, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances + utils.global - increment_progress_bar(element[, amount=0.01]) - Increment any progress bar by the given percentage + utils.game - decrement_progress_bar(element[, amount=0.01]) - Decrement any progress bar by the given percentage + ProgressBar.set_maximum(element, amount) + Sets the maximum value that represents the end value of the progress bar + + + ProgressBar.increment(element[, amount=1]) + Increases the value of the progressbar, if a define is given all of its instances have incremented + + + ProgressBar.decrement(element[, amount=1]) + Decreases the value of the progressbar, if a define is given all of its instances have decremented + + + ProgressBar.new_progressbar([name]) + Creates a new progressbar element define + + + ProgressBar._prototype:set_default_maximum(amount) + Sets the maximum value that represents the end value of the progress bar + + + ProgressBar._prototype:use_count_down([state=true]) + Will set the progress bar to start at 1 and trigger when it hits 0 + + + ProgressBar._prototype:increment([amount=1][, category]) + Increases the value of the progressbar + + + ProgressBar._prototype:increment_filtered([amount=1], filter) + Increases the value of the progressbar, if the filter condition is met, does not work with store + + + ProgressBar._prototype:decrement([amount=1][, category]) + Decreases the value of the progressbar + + + ProgressBar._prototype:decrement_filtered([amount=1], filter) + Decreases the value of the progressbar, if the filter condition is met, does not work with store + + + ProgressBar._prototype:add_element(element[, maximum]) + Adds an element into the list of instances that will are waiting to complete, does not work with store + note use store if you want persistent data, this only stores the elements not the values which they have + + + ProgressBar._prototype:reset_element(element) + Resets an element, or its store, to be back at the start, either 1 or 0 + + + ProgressBar._prototype:event_counter([filter]) + Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented + + + ProgressBar._prototype:event_countdown([filter]) + Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented -

Concept Control

+

Sliders

- - + - - + - - + - - + - - + + - - + + + + + + + + + +
require_concept(concept_name)Loads a concept from the concepts fileexpcore.gui.core
require_style(style_name)Loads a set of concepts from the styles fileexpcore.gui.prototype
get_concept(name)Gets a gui concept from name, id, or its selfexpcore.gui.instances
Prototype:save_as(save_name)Used to save the concept to the main gui module to allow access from other filesutils.game
new_concept([base_concept])Returns a new gui concept, option to provide a base concept to copy properties and draw functions fromSlider.new_slider([name])Creates a new slider element define
draw_concept(concept, parent)Used to draw a concept to a parent elementSlider._prototype:set_range([min][, max])Sets the range of a slider, if not used will use default values for a slider
Slider._prototype:draw_label(element)Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player
Slider._prototype:enable_auto_draw_label([state=true])Enables auto draw of the label, the label will share the same parent element as the slider
-

Element Control

+

Text

- - + - - + - - + - - + + - - + + - - + + - - + + - - + +
get_player_from_element(element)Gets the player who owns this elementexpcore.gui.core
valid(element)Simple check for if an element is validexpcore.gui.prototype
destroy(element)Destroies and element if it is validutils.game
find(element, ...)Finds and returns a gui element if it is valid from a long chain of element names or conceptsText.new_text_field([name])Creates a new text field element define
existsChecks if a gui element exists or not, returns it if found else the path where it failedText.new_text_box([name])Creates a new text box element define
toggle_enabled(element)Toggles the enabled state of an elementText._prototype_box:set_selectable([state=true])Sets the text box to be selectable
toggle_visible(element)Toggles the visible state of an elementText._prototype_box:set_word_wrap([state=true])Sets the text box to have word wrap
set_padding(element[, up=0][, down=0][, left=0][, right=0])Sets the padding for a gui elementText._prototype_box:set_read_only([state=true])Sets the text box to be read only
-

Store Categories

+

Instances

- - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
categorize_by_player(element)A categorize function to be used with add_store, each player has their own categoryutils.global
categorize_by_force(element)A categorize function to be used with add_store, each force has its own categoryInstances.has_categories(name)Returns if a instance group has a categorise function; must be registered
categorize_by_surface(element)A categorize function to be used with add_store, each surface has its own categoryInstances.is_registered(name)Returns if the given name is a registered instance group
Instances.register(name[, categorise])Registers the name of an instance group to allow for storing element instances
Instances.add_element(name, element)Adds an element to the instance group under the correct category; must be registered
Instances.get_elements_raw(name[, category])Gets all element instances without first removing any invalid ones; used internally and must be registered
Instances.get_valid_elements(name[, category][, callback])Gets all valid element instances and has the option of running a callback on those that are valid
Instances.unregistered_add_element(name, category, element)A version of add_element that does not require the group to be registered
Instances.unregistered_get_elements(name, category[, callback])A version of get_elements that does not require the group to be registered
-

Concept Base

+

Prototype

- - + - - + - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Prototype:clone(concept_name)Used to copy all the settings from one concept to another and removing links to the orginalutils.game
Prototype:define_clone(clone_callback)Use to add your own callbacks to the clone function, for example adding to a local tableexpcore.store
Prototype:save_as(save_name)Used to save the concept to the main gui module to allow access from other filesexpcore.gui.instances
Prototype:debug(name)Sets a debug name that can be used with error handlersConstructor.event(event_name)Creates a new function to add functions to an event handler
Prototype:new_event(event_name[, factorio_event][, event_condition])Adds a new event trigger to the concept which can be linked to a factorio eventConstructor.extend(new_prototype)Extents a prototype with the base functions of all gui prototypes, no metatables
Prototype:on_custom_event(handler)Adds a custom event handler, replace with the name of the eventConstructor.store(sync, callback)Creates a new function which adds a store to a gui define
Prototype:raise_event(event_name[, event={}][, from_factorio=false])Raises a custom event, folowing keys included automaticlly: concept, event name, game tick, player from player_index, element if validConstructor.setter(value_type, key[, second_key])Creates a setter function that checks the type when a value is set
Prototype:new_property(property_name[, setter_callback][, default])Adds a new property to the concept, such as caption, tooltip, or some custom property you want to controlPrototype:uid()Gets the uid for the element define
Prototype:set_custom_property(value)Sets a new value for a property, triggers setter method if provided, replace with property namePrototype.debug_nameSets a debug alias for the define
Prototype:define_draw(draw_callback)Used to define how the concept is turned into an ingame element or "instance" as we may refer to themPrototype.set_captionSets the caption for the element define
Prototype:draw(parent_element[, override_name])Calls all the draw functions in order to create this concept in game; will also store and sync the instance if stores are usedPrototype.set_tooltipSets the tooltip for the element define
Prototype.set_pre_authenticatorSets an authenticator that blocks the draw function if check fails
Prototype.set_post_authenticatorSets an authenticator that disables the element if check fails
Prototype.on_drawRegisters a callback to the on_draw event
Prototype.on_style_updateRegisters a callback to the on_style_update event
Prototype:set_style(style[, callback])Sets the style for the element define
Prototype:set_embedded_flow(state)Sets the element to be drawn inside a nameless flow, can be given a name using a function
Prototype:raise_event(event_name, ...)Raises a custom event for this define, any number of params can be given
Prototype:draw_to(element)The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions
Prototype:get_store(category)Gets the value in this elements store, category needed if categorize function used
Prototype:set_store(category, value)Sets the value in this elements store, category needed if categorize function used
Prototype:clear_store([category])Sets the value in this elements store to nil, category needed if categorize function used
-

Concept Instances

+

Test

- - + - - + - - + - - - - -
Prototype:define_instance_store([category_callback])Adds an instance store to the concept; when a new instance is made it is stored so you can access it laterexpcore.gui
Prototype.get_instances([category])Gets all insatnces in a category, category may be nil to return allexpcore.common
Prototype.add_instance(element[, category])Adds an instance to this concept, used automatically during concept:drawresources.color_presets
Prototype.update_instances([category], update_callback)Applies an update function to all instances, simialr use to what table.forEach would be
- - -

Concept Data

- - - - - - + - - - - - - - - - - - - - - - - -
Prototype:define_data_store([category_callback])Adds a data store to this concept which allows you to store synced/percistent data between instancesutils.event
Prototype.get_data([category])Gets the data that is stored for this category
Prototype.set_data([category], value)Sets the data that is stored for this category
Prototype.clear_data([category])Clears the data that is stored for this category
Prototype.update_data([category], update_callback)Updates the data that is stored for this category
- - -

Concept Combined Instances

- - - - - - - - - - - - -
Prototype:define_combined_store([category_callback], sync_callback)Used to add a both instance and data store which are linked together, new instances are synced to the current value, changing the stored value will change all instances
Prototype.sync_instance(element)Will sync an instance to match the stored value based on the given sync callback
- - -

Tests

- - - - - - +
run_tests(player[, category])Runs a set of gui tests to ensure that the system is workingexpcore.store
@@ -664,122 +1117,20 @@ Gui.new_concept('button') -- W
-

Elements

+

Dependencies

- # - button + # + expcore.gui.core
-

Clickable elements that fire on_gui_click when clicked.

-

- Properties / Events: - -
    - - - - - -
  • - - on_click - - : - - - fired when the player clicks the button - -
  • - - - - - -
  • - - on_left_click - - : - - - fired when the player clicks with the right mouse button - -
  • - - - - - -
  • - - on_left_click - - : - - - fired when the player clicks with the right mouse button - -
  • - - - - - -
  • - - caption - - : - - (string or LocalisedString) - - the message that is shown on the button - -
  • - - - - - -
  • - - tooltip - - : - - (string or LocalisedString) - - the tooltip that shows when a player hovers over the button - -
  • - - - - - -
  • - - sprite - - : - - (SpritePath) - - upto three sprites in the order: default, hovered, clicked - -
  • - - -
- @@ -790,126 +1141,21 @@ Gui.new_concept('button') -- W - Usage: -
-- Making a basic button
-local basic_button =
-Gui.new_concept('button')
-:set_caption('Basic Button')
-:set_tooltip('Basic button')
-:on_click(function(event)
-    event.player.print('You pressed basic button!')
-end)
-
-- Making a sprite button
-local sprite_button =
-Gui.new_concept('button')
-:set_sprite('utility/warning_icon')
-:set_tooltip('Sprite button')
-:on_click(function(event)
-    event.player.print('You pressed sprite button!')
-end)
- # - checkbox + # + expcore.gui.instances
-

Clickable elements with a cross in the middle that can be turned off or on.

-

- Properties / Events: - -
    - - - - - -
  • - - on_state_changed - - : - - - fired when the state of the element is changed - -
  • - - - - - -
  • - - caption - - : - - (string or LocalisedString) - - the message that is shown next to the checkbox - -
  • - - - - - -
  • - - tooltip - - : - - (string or LocalisedString) - - the tooltip that shows when a player hovers over the checkbox - -
  • - - - - - -
  • - - default - - : - - (boolean or function) - - the default state of this checkbox, or a function which returns the default state - -
  • - - - - - -
  • - - use_radio - - : - - (boolean) - - setting to true will use radio buttons rather than checkboxs - -
  • - - -
- @@ -920,118 +1166,21 @@ Gui.new_concept('button') - Usage: -
-- Making a basic checkbox
-local basic_checkbox =
-Gui.new_concept('checkbox')
-:set_caption('Basic Checkbox')
-:set_tooltip('Basic checkbox')
-:on_state_changed(function(event)
-    event.player.print('Basic checkbox is now: '..tostring(event.element.state))
-end)
- # - dropdown + # + expcore.gui.elements.buttons
-

A drop down list of other elements.

-

- Properties / Events: - -
    - - - - - -
  • - - on_selection_changed - - : - - - fired when the selected value is changed - -
  • - - - - - -
  • - - default - - : - - (string, LocalisedString or function) - - the option which is selected by default, or a function which returns the default - -
  • - - - - - -
  • - - use_list_box - - : - - (boolean) - - when true a list box will be used rather than a dropdown menu - -
  • - - - - - -
  • - - static_items - - : - - (nil or table) - - when called with a table the values will be added as items for the dropdown, if called with nil then all items are cleared - -
  • - - - - - -
  • - - dynamic_items - - : - - (function) - - the given function will be called to return a list of items and optional start index to add items to the dropdown when it is first drawn - -
  • - - -
- @@ -1042,100 +1191,21 @@ Gui.new_concept('checkbox') - Usage: -
-- Making a basic dropdown
-local static_dropdown =
-Gui.new_concept('dropdown')
-:set_static_items{'Option 1','Option 2','Option 3'}
-:on_selection_changed(function(event)
-    local value = Gui.get_dropdown_value(event.element)
-    event.player.print('Static dropdown is now: '..value)
-end)
-
-- Making a dropdown with dynamic items, example is name of online players
-local dynamic_dropdown =
-Gui.new_concept('dropdown')
-:set_dynamic_items(function(element)
-    local items = {}
-    for _,player in pairs(game.connected_players) do
-        items[#items+1] = player.name
-    end
-    return items
-end)
-:on_selection_changed(function(event)
-    local value = Gui.get_dropdown_value(event.element)
-    event.player.print('Dynamic dropdown is now: '..value)
-end)
- # - elem_button + # + expcore.gui.elements.checkbox
-

A button that lets the player pick one of an: item, entity, tile, or signal similar to the filter-select window.

-

- Properties / Events: - -
    - - - - - -
  • - - on_selection_changed - - : - - - fired when the selected value is changed - -
  • - - - - - -
  • - - default - - : - - (string, SignalID or function) - - the option which is selected by default, or a function which returns the default - -
  • - - - - - -
  • - - elem_type - - : - - (string) - - the type of elem selection that this is, default is item selection - -
  • - - -
- @@ -1146,53 +1216,21 @@ Gui.new_concept('dropdown') - Usage: -
-- Making a basic elem button
-local basic_elem_button =
-Gui.new_concept('elem_button')
-:on_selection_changed(function(event)
-    event.player.print('Basic elem button is now: '..event.element.elem_value)
-end)
- # - empty + # + expcore.gui.elements.dropdown
-

A empty widget that just exists.

-

The root GUI element screen is an empty-widget.

- Properties / Events: - -
    - - - - - -
  • - - style - - : - - (string) - - the style that the element will have - -
  • - - -
- @@ -1203,51 +1241,21 @@ Gui.new_concept('elem_button') - Usage: -
-- Making a draggable space styled widget
-local draggable_space =
-Gui.new_concept('empty')
-:set_style('draggable_space')
- # - flow + # + expcore.gui.elements.slider
-

Invisible containers that lay out children either horizontally or vertically.

-

The root GUI elements (top, left and center; see LuaGui) are flows.

- Properties / Events: - -
    - - - - - -
  • - - direction - - : - - (string) - - the direction that children will be added - -
  • - - -
- @@ -1258,72 +1266,21 @@ Gui.new_concept('empty') - Usage: -
-- Making a basic flow, contains a label with hello world
-local basic_flow =
-Gui.new_concept('flow')
-:define_draw(function(properties,parent,element)
-    element.add{
-        type = 'label',
-        caption = 'Hello, World!'
-    }
-end)
- # - frame + # + expcore.gui.elements.text
-

Grey semi-transparent boxes that contain other elements.

-

They have a caption, and, just like flows, they lay out children either horizontally or vertically.

- Properties / Events: - -
    - - - - - -
  • - - title - - : - - (string or LocalisedString) - - the title that will show in the frame - -
  • - - - - - -
  • - - direction - - : - - (string) - - the direction that children will be added - -
  • - - -
- @@ -1334,89 +1291,21 @@ Gui.new_concept('flow') - Usage: -
-- Making a basic frame, contains a label with hello world
-local basic_frame =
-Gui.new_concept('frame')
-:set_title('Basic Frame')
-:define_draw(function(properties,parent,element)
-    element.add{
-        type = 'label',
-        caption = 'Hello, World!'
-    }
-end)
- # - label + # + expcore.gui.elements.elem-button
-

A piece of text.

-

- Properties / Events: - -
    - - - - - -
  • - - caption - - : - - (string or LocalisedString) - - the caption that will show in the label - -
  • - - - - - -
  • - - description - - : - - (string or LocalisedString) - - the description that will show on the label - -
  • - - - - - -
  • - - rich_text - - : - - (defines.rich_text_setting) - - how this element handles rich text - -
  • - - -
- @@ -1427,51 +1316,21 @@ Gui.new_concept('frame') - Usage: -
-- Making a basic label
-local basic_label =
-Gui.new_concept('label')
-:set_caption('Hello, World!')
- # - line + # + expcore.gui.elements.progress-bar
-

A vertical or horizontal line.

-

- Properties / Events: - -
    - - - - - -
  • - - direction - - : - - (string) - - the direction that children will be added - -
  • - - -
- @@ -1482,113 +1341,21 @@ Gui.new_concept('label') - Usage: -
-- Making a basic frame, contains a label with hello world
-local basic_line =
-Gui.new_concept('line')
- # - progress_bar + # + expcore.gui.concepts.toolbar
-

Indicate progress by displaying a partially filled bar.

-

- Properties / Events: - -
    - - - - - -
  • - - on_completion - - : - - - fired when increment reaches the maxium value set by set_maximum - -
  • - - - - - -
  • - - tooltip - - : - - (string or LocalisedString) - - the tooltip that will show for this element - -
  • - - - - - -
  • - - maximum - - : - - (number) - - the maxium amount an instance can be increased, default 100 - -
  • - - - - - -
  • - - delay_completion - - : - - (boolean) - - when true the progress will be completed untill after the maximum rather than at the maximum - -
  • - - - - - -
  • - - inverted - - : - - (boolean) - - although this will NOT effect how you use the functions it will make the element start full and reduce as you call increase, note issues with 0 detections - -
  • - - -
- @@ -1599,76 +1366,21 @@ Gui.new_concept('line') - Usage: -
-- Making a basic progress bar, will increase when pressed then will reset when full
-local basic_progress_bar =
-Gui.new_concept('progress_bar')
-:set_tooltip('Basic progress bar')
-:set_maximum(5)
-:new_event('on_click',defines.events.on_gui_click)
-:on_click(function(event)
-    event.concept:increment(event.element)
-end)
-:set_delay_completion(true)
-:on_completion(function(event)
-    event.concept:reset(event.element)
-end)
- # - scroll + # + expcore.gui.concepts.left
-

Similar to a flow but includes the ability to show and use scroll bars.

-

- Properties / Events: - -
    - - - - - -
  • - - horizontal_scroll - - : - - (string) - - the horizontal scroll policy for this scroll pane - -
  • - - - - - -
  • - - vertical_scroll - - : - - (string) - - the vertical scroll policy for this scroll pane - -
  • - - -
- @@ -1679,122 +1391,21 @@ Gui.new_concept('progress_bar') - Usage: -
-- Making a basic flow, contains a label with hello world
-local basic_scroll =
-Gui.new_concept('scroll')
-:define_draw(function(properties,parent,element)
-    element.style.hieght = 50
-    for i = 1,10 do
-        element.add{
-            type = 'label',
-            caption = i
-        }
-    end
-end)
- # - slider + # + expcore.gui.concepts.center
-

A number picker.

-

- Properties / Events: - -
    - - - - - -
  • - - on_value_changed - - : - - - fired when the value of the slider is changed - -
  • - - - - - -
  • - - value_step - - : - - (number) - - the minimum amount by which the value of the slider can be changed - -
  • - - - - - -
  • - - default - - : - - (number or function) - - the default value of the slider or a function which returns the default value - -
  • - - - - - -
  • - - discrete_slider - - : - - (boolean) - - makes this slider a discrete slider, this means that the slider button will stop at the same interval as the values do - -
  • - - - - - -
  • - - range - - : - - (number or function) - - accepts two params the minimum and the maximum for this slider, or a single function to return both - -
  • - - -
- @@ -1805,127 +1416,21 @@ Gui.new_concept('scroll') - Usage: -
-- Making a basic slider
-local basic_slider =
-Gui.new_concept('slider')
-:set_range(1,10)
-:on_value_changed(function(event)
-    event.player.print('Basic slider is now: '..event.element.slider_value)
-end)
-
-- Making a discrete_slider
-local discrete_slider =
-Gui.new_concept('slider')
-:set_range(1,10)
-:set_value_step(1)
-:set_discrete_slider(true)
-:on_value_changed(function(event)
-    event.player.print('Interval slider is now: '..event.element.slider_value)
-end)
- # - table + # + expcore.gui.concepts.popups
-

An invisible container that lays out children in a specific number of columns.

-

Column width is given by the largest element contained in that row.

- Properties / Events: - -
    - - - - - -
  • - - column_count - - : - - (number or function) - - the column count of the table or a function that returns the count being given then parent element - -
  • - - - - - -
  • - - vertical_lines - - : - - (boolean) - - when true vertical lines will be drawn on the table - -
  • - - - - - -
  • - - horizontal_lines - - : - - (boolean) - - when true horizontal lines will be drawn on the table - -
  • - - - - - -
  • - - header_lines - - : - - (boolean) - - when true horizontal lines will be drawn under the first row - -
  • - - - - - -
  • - - vertical_centering - - : - - (boolean) - - when true element will be vertically centered with in the table - -
  • - - -
- @@ -1936,440 +1441,123 @@ Gui.new_concept('slider') - Usage: -
-- Making a basic table, contains 25 labels
-local basic_table =
-Gui.new_concept('table')
-:set_column_count(5)
-:define_draw(function(properties,parent,element)
-    for i = 1,25 do
-        element.add{
-            type = 'lable',
-            caption = i
-        }
-    end
-end)
- - -
-
-
-
- # - text_box -
-
-
-
- -

A multi-line text box that supports selection and copy-paste.

-

- - - Properties / Events: - -
    - - - - - -
  • - - on_text_changed - - : - - - fired when the text within the text box is changed - -
  • - - - - - -
  • - - tooltip - - : - - (string or LocalisedString) - - the tooltip that shows when a player hovers over the text box - -
  • - - - - - -
  • - - default - - : - - (string or function) - - the default text that will appear in the text box, or a function that returns it - -
  • - - - - - -
  • - - rich_text - - : - - (defines.rich_text_setting) - - how this element handles rich text - -
  • - - - - - -
  • - - clear_on_rmb - - : - - (boolean) - - if the text box will be cleared and forcused on a right click - -
  • - - - - - -
  • - - is_selectable - - : - - (boolean) - - when true the text inside the box can be selected - -
  • - - - - - -
  • - - has_word_wrap - - : - - (boolean) - - when true the text will wrap onto the next line if it reachs the end - -
  • - - - - - -
  • - - is_read_only - - : - - (boolean) - - when true the text inside the box can not be edited by the player - -
  • - - -
- - - - - - - - - - - - Usage: -
-- Making a text box
-local basic_text_box =
-Gui.new_concept('text_box')
-:set_default('I am the text that will show in the text box')
-
-- Making a text box which can be edited
-local editible_text_box =
-Gui.new_concept('text_box')
-:set_is_read_only(false)
-:set_default('I am the text that will show in the text box')
-:on_confirmation(function(event)
-    event.player.print('Editible text box is now: '..event.element.text)
-end)
- - -
-
-
-
- # - text_field -
-
-
-
- -

Boxes of text the user can type in.

-

- - - Properties / Events: - -
    - - - - - -
  • - - on_text_changed - - : - - - fired when the text within the text field is changed - -
  • - - - - - -
  • - - on_confirmation - - : - - - fired when the player presses enter with the text field forcused - -
  • - - - - - -
  • - - tooltip - - : - - (string or LocalisedString) - - the tooltip that shows when a player hovers over the text field - -
  • - - - - - -
  • - - default - - : - - (string or function) - - the default text that will appear in the text field, or a function that returns it - -
  • - - - - - -
  • - - rich_text - - : - - (defines.rich_text_setting) - - how this element handles rich text - -
  • - - - - - -
  • - - clear_on_rmb - - : - - (boolean) - - if the text field will be cleared and forcused on a right click - -
  • - - - - - -
  • - - lose_forcus - - : - - (boolean) - - if the text field will lose forcus after the confirmation event - -
  • - - - - - -
  • - - is_number - - : - - (boolean) - - if this text field contains a number value, can be ignored if is_decimal or is_negitive is used - -
  • - - - - - -
  • - - is_decimal - - : - - (boolean) - - if this text field contains a decimal value - -
  • - - - - - -
  • - - is_negative - - : - - (boolean) - - if this text field contains a negative value - -
  • - - - - - -
  • - - is_password - - : - - (boolean) - - if this text field contains a password value - -
  • - - -
- - - - - - - - - - - - Usage: -
-- Making a text field
-local basic_text_field =
-Gui.new_concept('text_field')
-:on_confirmation(function(event)
-    event.player.print('Basic text field is now: '..event.element.text)
-end)
-
-- Making a text field which will clear on right click and un forcus on confirmation
-local better_text_field =
-Gui.new_concept('text_field')
-:set_clear_on_rmb(true)
-:set_lose_forcus(true)
-:on_confirmation(function(event)
-    event.player.print('Better text field is now: '..event.element.text)
-end)
-
-- Making a decimal input
-local decimal_text_field =
-Gui.new_concept('text_field')
-:set_is_decimal(true)
-:on_confirmation(function(event)
-    event.player.print('Decimal text field is now: '..event.element.text)
-end)
-

Dropdowns

+

Center Guis

- # - set_dropdown_value(element, value) + # + expcore.gui.core
-

Selects the index of a dropdown with this value

+ + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.prototype +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + expcore.gui.concepts.toolbar +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + utils.game +
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+ # + CenterFrames.get_flow(player) +
+
+
+
+ +

Gets the center flow for a player

@@ -2383,29 +1571,13 @@ Gui.new_concept('text_field')
  • - element + player : - (LuaGuiElement) + (LuaPlayer) - the dropdown that you want to set the selection for - -
  • - - - - - -
  • - - value - - : - - (string or LocalisedString) - - the value that you want selected + the player to get the flow for
  • @@ -2418,147 +1590,337 @@ Gui.new_concept('text_field') Returns: + + + + + + + + + +
    +
    +
    +
    + # + CenterFrames.clear_flow(player) +
    +
    +
    +
    + +

    Clears the center flow for a player

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to clear the flow for + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + CenterFrames.draw_frame(player, name) +
    +
    +
    +
    + +

    Draws the center frame for a player, if already open then will do nothing

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player that will have the frame drawn + +
    • + + + + + +
    • + + name + + : + + (string) + + the name of the hui that will drawn + +
    • + + +
    + + + + + Returns: + + + + + + + + + + +
    +
    +
    +
    + # + CenterFrames.redraw_frame(player, name) +
    +
    +
    +
    + +

    Draws the center frame for a player, if already open then will destroy it and redraw

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player that will have the frame drawn + +
    • + + + + + +
    • + + name + + : + + (string) + + the name of the hui that will drawn + +
    • + + +
    + + + + + Returns: + + + + + + + + + + +
    +
    +
    +
    + # + CenterFrames.toggle_frame(player, name[, state]) +
    +
    +
    +
    + +

    Toggles if the frame is currently open or not, will open if closed and close if open

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player that will have the frame toggled + +
    • + + + + + +
    • + + name + + : + + (string) + + the name of the hui that will be toggled + +
    • + + + + + +
    • + + state + + : + (boolean) - if an item with this value was found -
    • -
    - - - - - - - Usage: -
    -- Selecting the item with the value 'foo'
    -Gui.set_dropdown_value(element,'foo')
    - - -
    -
    -
    -
    - # - get_dropdown_value(element) -
    -
    -
    -
    - -

    Gets the selected item value of a dropdown

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the dropdown that you want the selected value of - -
    • - - -
    - - - - - Returns: - - - - - - - - - Usage: -
    -- Getting the selected value
    -local selected_value = Gui.get_dropdown_value(element)
    - - -
    -
    -
    -
    - # - add_dropdown_items(element[, start_index], new_items) -
    -
    -
    -
    - -

    Adds the given items into the list of items for this dropdown

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the dropdown that you want to add the items to - -
    • - - - - - -
    • - - start_index - - : - - (number) - - the index at which the items will be added, if not given appened to the end + when set will force a state for the frame (optional)
    • +
    + + + + + Returns: +
      +
    • + (boolean) + if the frame if no open or closed +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + CenterFrames.new_frame(permission_name) +
    +
    +
    +
    + +

    Creates a new center frame define

    +

    + + + Parameters: + +
      + +
    • - new_items + permission_name : - (table) + (string) - the list of new items that you want to add + the name that can be used with the permission system
    • @@ -2572,7 +1934,7 @@ Gui.new_concept('text_field')
      • (table) - the list of items that the element now has + the new center frame define
      @@ -2582,28 +1944,20 @@ Gui.new_concept('text_field') - Usage: -
      -- Add the items 'foo' and 'bar' to the end
      -Gui.add_dropdown_items(element,{'foo','bar'})
      -
      -- Add the items 'foo' and 'bar' to the start
      -Gui.add_dropdown_items(element,1,{'foo','bar'})
    -
    -

    Progress Bars

    -
    - # - progress_bar:increment(element[, amount=1]) + # + CenterFrames._prototype:set_auto_focus([state=true])
    -

    Will increase the progress of a progress bar based on this concept, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances

    +

    Sets the frame to be the current active gui when opened and closes all other frames

    @@ -2617,31 +1971,15 @@ Gui.new_concept('text_field')
  • - element + state : - (LuaGuiElement or string) + (boolean) - either the element that is changed or the category that is being changed (only if an instance store is defined) + when true will auto close other frames and set this frame as player.opened -
  • - - - - - -
  • - - amount - - : - - (number) - - the amount that will bar will increase, note that this amount must be less than the max - - (default: 1) + (default: true)
  • @@ -2650,13 +1988,6 @@ Gui.new_concept('text_field') - Returns: -
      -
    • - (number or nil) - the new value of the element, use this to sync a data store, if the return is nil then either a instance store was used or the new value may have changed -
    • -
    @@ -2664,25 +1995,20 @@ Gui.new_concept('text_field') - Usage: -
    -- Incrementing progress bar with no instance store
    -local new_value = progress_bar:increment(element)
    -
    -- Incrementing progress bar with an instance store
    -progress_bar:increment(category)
    - # - progress_bar:decrement(element[, amount=1]) + # + CenterFrames._prototype:draw_frame(player)
    -

    Will decrease the progress of a progress bar based on this concept, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances

    +

    Draws this frame to the player, if already open does nothing (will call on_draw to draw to the frame)

    @@ -2696,92 +2022,13 @@ Gui.new_concept('text_field')
  • - element + player : - (LuaGuiElement or string) + (LuaPlayer) - either the element that is changed or the category that is being changed (only if an instance store is defined) - -
  • - - - - - -
  • - - amount - - : - - (number) - - the amount that will bar will decrease, note that this amount must be less than the max - - (default: 1) -
  • - - - - - - - - Returns: -
      -
    • - (number) - the new value of the element, use this to sync a data store, if the return is nil then either a instance store was used or the new value may have changed -
    • -
    - - - - - - - - Usage: -
    -- Decrementing progress bar with no instance store
    -local new_value = progress_bar:decrement(element)
    -
    -- Decrementing progress bar with an instance store
    -progress_bar:decrement(category)
    - - -
    -
    -
    -
    - # - progress_bar:reset(element) -
    -
    -
    -
    - -

    Resets the progress back to 0% for this element, if the concept has an instance store then element acts as the category, if you have a combined store it will NOT update all instances

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement or string) - - either the element that is changed or the category that is being changed (only if an instance store is defined) + the player to draw the frame for
    • @@ -2794,58 +2041,37 @@ Gui.new_concept('text_field') Returns:
      • - (number or nil) - the new value of the element, use this to sync a data store, if the return is nil then either a instance store was used or the new value may have changed -
      • -
      - - - - - - - - Usage: -
      -- Reseting a progress bar with no instance store
      -local new_value = progress_bar:reset(element)
      -
      -- Reseting a progress bar with an instance store
      -progress_bar:reset(category)
      - - -
    -
    -
    -
    - # - increment_progress_bar(element[, amount=0.01]) -
    -
    -
    -
    - -

    Increment any progress bar by the given percentage

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - (LuaGuiElement) - - the progress bar that you want to update - + the new frame that was drawn
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + CenterFrames._prototype:redraw_frame(player) +
    +
    +
    +
    + +

    Draws this frame to the player, if already open it will remove it and redraw it (will call on_draw to draw to the frame)

    +

    + + + Parameters: + +
      @@ -2853,15 +2079,71 @@ Gui.new_concept('text_field')
    • - amount + player : - (number) + (LuaPlayer) - the percentage that you want to increment the progress bar by + the player to draw the frame for + +
    • + + +
    + + + + + Returns: + + + + + + + + + + +
    +
    +
    +
    + # + CenterFrames._prototype:toggle_frame(player) +
    +
    +
    +
    + +

    Toggles if the frame is open, if open it will close it and if closed it will open it

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to draw the frame for - (default: 0.01)
    • @@ -2874,7 +2156,7 @@ Gui.new_concept('text_field')
      • (boolean) - true if the bar is now full + with the gui frame is now open
      @@ -2884,23 +2166,20 @@ Gui.new_concept('text_field') - Usage: -
      -- Increment any progress bar by 10%
      -Gui.increment_progress_bar(element,0.1)
    - # - decrement_progress_bar(element[, amount=0.01]) + # + CenterFrames._prototype:event_handler([action=update])
    -

    Decrement any progress bar by the given percentage

    +

    Creates an event handler that will trigger one of its functions, use with Event.add

    @@ -2914,31 +2193,243 @@ Gui.new_concept('text_field')
  • - element + action : - (LuaGuiElement) + (string) - the progress bar that you want to update + the action to take on this event + (default: update)
  • + + + + + + + + + + + + + + +
    +
    +

    Left Guis

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.concepts.toolbar +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.elements.buttons +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + mod-gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames.get_flow(player) +
    +
    +
    +
    + +

    Gets the left frame flow for a player

    +

    + + + Parameters: + +
      + +
    • - amount + player : - (number) + (LuaPlayer) - the percentage that you want to decrement the progress bar by + the player to get the flow of - (default: 0.01)
    • @@ -2950,8 +2441,8 @@ Gui.new_concept('text_field') Returns: @@ -2961,132 +2452,20 @@ Gui.new_concept('text_field') - Usage: -
      -- Decrement any progress bar by 10%
      -Gui.decrement_progress_bar(element,0.1)
      - - -
    -
    -

    Concept Control

    -
    -
    -
    -
    - # - require_concept(concept_name) -
    -
    -
    -
    - -

    Loads a concept from the concepts file

    -

    - - - Parameters: - -
      - - - - - -
    • - - concept_name - - : - - (string) - - the name of the concept to require - -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Load a base concept
    -Gui.require_concept('frame') --- @dep Gui.concept.frame
    - # - require_style(style_name) + # + LeftFrames.get_frame(name, player)
    -

    Loads a set of concepts from the styles file

    -

    - - - Parameters: - -
      - - - - - -
    • - - style_name - - : - - (string) - - the name of the style to require - -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Load a base style
    -Gui.require_concept('expgaming') --- @dep Gui.style.frame
    - - -
    -
    -
    -
    - # - get_concept(name) -
    -
    -
    -
    - -

    Gets a gui concept from name, id, or its self

    +

    Gets one frame from the left flow by its name

    @@ -3104,9 +2483,25 @@ Gui.new_concept('text_field') : - (string, number or table) + (string) - the name, id, or the concept you want to get + the name of the gui frame to get + + + + + + + +
  • + + player + + : + + (LuaPlayer) + + the player to get the frame of
  • @@ -3116,6 +2511,13 @@ Gui.new_concept('text_field') + Returns: +
      +
    • + (LuaGuiElement) + the frame in the left frame flow with that name +
    • +
    @@ -3123,23 +2525,20 @@ Gui.new_concept('text_field') - Usage: -
    -- Getting a gui concept
    -local button = Gui.get_concept('Button')
    - # - Prototype:save_as(save_name) + # + LeftFrames.get_open(player)
    -

    Used to save the concept to the main gui module to allow access from other files

    +

    Gets all open frames for a player, if non are open it will remove the close all button

    @@ -3153,69 +2552,102 @@ Gui.new_concept('text_field')
  • - save_name + player + + : + + (LuaPlayer) + + the player to get the flow of + +
  • + + + + + + + + Returns: +
      +
    • + (table) + contains all the open (and registered) frames for the player +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames.toggle_frame(name, player[, state]) +
    +
    +
    +
    + +

    Toggles the visibility of a left frame, or sets its visibility state

    +

    + + + Parameters: + +
      + + + + + +
    • + + name : (string) - the new name of the concept + the name of the gui frame to toggle
    • -
    - - - - - - - - - - - - Usage: -
    -- Save a concept to allow access in another file
    -button:save_as('button')
    -
    -- Access concept after being saved
    -Gui.concepts.button
    -Gui.get_concept('button')
    - - -
    -
    -
    -
    - # - new_concept([base_concept]) -
    -
    -
    -
    - -

    Returns a new gui concept, option to provide a base concept to copy properties and draw functions from

    -

    - - - Parameters: - -
      - -
    • - base_concept + player : - (string, number or table) + (LuaPlayer) - the concept that you want to copy the details of + the player to get the frame of + +
    • + + + + + +
    • + + state + + : + + (boolean) + + when given will be the state that the visibility is set to (optional)
    • @@ -3226,6 +2658,13 @@ Gui.get_concept('button') + Returns: +
        +
      • + (boolean) + the new state of the visibility +
      • +
      @@ -3233,23 +2672,20 @@ Gui.get_concept('button') - Usage: -
      -- Making a new button, see module usage
      -local button = Gui.new_concept('Button')
    - # - draw_concept(concept, parent) + # + LeftFrames.new_frame(permission_name)
    -

    Used to draw a concept to a parent element

    +

    Creates a new left frame define

    @@ -3263,29 +2699,174 @@ Gui.get_concept('button')
  • - concept + permission_name : - (string, number or table) + (string) - the name of the concept that you want to draw + the name that can be used with the permission system
  • + + + + + + Returns: +
      +
    • + (table) + the new left frame define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:set_open_by_default([state=true]) +
    +
    +
    +
    + +

    Sets if the frame is visible when a player joins, can also be a function to return a boolean

    +

    + + + Parameters: + +
      + +
    • - parent + state : - (LuaGuiElement) + (boolean or function) - the element that will act as a parent for the new element + the default state of the visibility, can be a function + state param - player LuaPlayer - the player that has joined the game + state param - define_name string - the define name for the frame + state return - boolean - false will hide the frame + + (default: true) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:set_direction(direction) +
    +
    +
    +
    + +

    Sets the direction of the frame, either vertical or horizontal

    +

    + + + Parameters: + +
      + + + + + +
    • + + direction + + : + + (string) + + the direction to have the elements be added to the frame + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:_internal_draw(player) +
    +
    +
    +
    + +

    Creates the gui for the first time, used internally

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to draw the frame to
    • @@ -3299,7 +2880,7 @@ Gui.get_concept('button')
      • (LuaGuiElement) - the element that was created + the frame that was made
      @@ -3309,26 +2890,672 @@ Gui.get_concept('button') - Usage: -
      -- Drawing a new element
      -Gui.draw_concept('Button',element)
      + + +
    +
    +
    +
    + # + LeftFrames._prototype:get_frame(player) +
    +
    +
    +
    + +

    Gets the frame for this define from the left frame flow

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
    • + + +
    + + + + + Returns: +
      +
    • + (LuaGuiElement) + the frame in the left frame flow for this define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:is_open(player) +
    +
    +
    +
    + +

    Returns if the player currently has this define visible

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to get the frame of + +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + true if it is open/visible +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:toggle(player) +
    +
    +
    +
    + +

    Toggles the visibility of the left frame

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to toggle the frame of + +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + the new state of the visibility +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:update(player) +
    +
    +
    +
    + +

    Updates the contents of the left frame, first tries update callback, other wise will clear and redraw

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to update the frame of + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:update_all([update_offline=false]) +
    +
    +
    +
    + +

    Updates the frame for all players, see update

    +

    + + + Parameters: + +
      + + + + + +
    • + + update_offline + + : + + (boolean) + + when true will update the frame for offline players + + (default: false) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:redraw(player) +
    +
    +
    +
    + +

    Redraws the frame by calling on_draw, will always clear the frame

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to update the frame of + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:redraw_all([update_offline=false]) +
    +
    +
    +
    + +

    Redraws the frame for all players, see redraw

    +

    + + + Parameters: + +
      + + + + + +
    • + + update_offline + + : + + (boolean) + + when true will update the frame for offline players + + (default: false) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + LeftFrames._prototype:event_handler([action=update]) +
    +
    +
    +
    + +

    Creates an event handler that will trigger one of its functions, use with Event.add

    +

    + + + Parameters: + +
      + + + + + +
    • + + action + + : + + (string) + + the action to take on this event + + (default: update) +
    • + + +
    + + + + + + + + + + +
    -

    Element Control

    +

    Popups

    - # - get_player_from_element(element) + # + expcore.gui.core
    -

    Gets the player who owns this element

    + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.elements.progress-bar +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.elements.buttons +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + mod-gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + resources.color_presets +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.global +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + PopupFrames.get_flow(player) +
    +
    +
    +
    + +

    Gets the left flow that contains the popup frames

    @@ -3342,73 +3569,13 @@ Gui.get_concept('button')
  • - element + player : - (LuaGuiElement) - - the element that you want to get the player of - -
  • - - - - - - - - Returns: -
      -
    • (LuaPlayer) - the player who owns this element -
    • -
    - - - - - - - Usage: -
    -- Getting the player of an element
    -local player = Gui.get_player_from_element(element)
    - - -
    -
    -
    -
    - # - valid(element) -
    -
    -
    -
    - -

    Simple check for if an element is valid

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the element that you want to check is valid + the player to get the flow for
    • @@ -3421,8 +3588,8 @@ Gui.get_concept('button') Returns:
      • - (boolean) - true if the element is valid + (LuaGuiElement) + the left flow that contains the popup frames
      @@ -3432,23 +3599,20 @@ Gui.get_concept('button') - Usage: -
      -- Return if not valid
      -if not Gui.valid(element) then return end
    - # - destroy(element) + # + PopupFrames.open(define_name, player[, open_time], ...)
    -

    Destroies and element if it is valid

    +

    Opens a popup for the player, can give the amount of time it is open as well as params for the draw function

    @@ -3462,73 +3626,29 @@ Gui.get_concept('button')
  • - element + define_name : - (LuaGuiElement) + (string) - the element that you want to destroy + the name of the define that you want to open for the player
  • - - - - - - Returns: -
      -
    • - (boolean) - true if the element was valid and was destoried -
    • -
    - - - - - - - - Usage: -
    -- Destoring an element
    -Gui.destroy(element)
    - - -
    -
    -
    -
    - # - find(element, ...) -
    -
    -
    -
    - -

    Finds and returns a gui element if it is valid from a long chain of element names or concepts

    -

    - - - Parameters: - -
      - -
    • - element + player : - (LuaGuiElement) + (LuaPlayer) - the root element to start checking from + the player to open the popup for
    • @@ -3536,15 +3656,32 @@ Gui.get_concept('button') +
    • + + open_time + + : + + (number) + + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + + (optional) +
    • + + + + +
    • ... : - (string or table) + (any) - element names or element concepts that point to your element + the other params that you want to pass to your on_draw event
    • @@ -3557,23 +3694,836 @@ Gui.get_concept('button') Returns:
      • - (boolean) - if the element was found, failed + (LuaGuiElement) + the frame that was drawn, the inner gui flow which contains the content
      • +
      + + + + + + + + + +
    +
    +
    +
    + # + PopupFrames.close_progress +
    +
    +
    +
    + +

    Progress bar which when depleted will close the popup frame

    +

    + + + + + + + + + + + + + + +
    +
    +
    +
    + # + PopupFrames.close_button +
    +
    +
    +
    + +

    A button which can be used to close the gui before the timer runs out

    +

    + + + + + + + + + + + + + + +
    +
    +
    +
    + # + PopupFrames.new_popup([name]) +
    +
    +
    +
    + +

    Creates a new popup frame define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new popup frame define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + PopupFrames._prototype:set_default_open_time(amount) +
    +
    +
    +
    + +

    Sets the default open time for the popup, will be used if non is provided with open

    +

    + + + Parameters: + +
      + + + + + +
    • + + amount + + : + + (number) + + the number of ticks, by default, the popup will be open for + +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the define to allow for chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + PopupFrames._prototype:open(player[, open_time], ...) +
    +
    +
    +
    + +

    Opens this define for a player, can be given open time and any other params for the draw function

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to open the popup for + +
    • + + + + + +
    • + + open_time + + : + + (number) + + the minimum number of ticks you want the popup open for, 0 means no limit, nil will take default + + (optional) +
    • + + + + + +
    • + + ... + + : + + (any) + + the other params that you want to pass to your on_draw event + +
    • + + +
    + + + + + Returns: +
      +
    • + (LuaGuiElement) + the frame that was drawn, the inner gui flow which contains the content +
    • +
    + + + + + + + + + +
    +
    +

    Toolbar

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.elements.buttons +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.roles +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + mod-gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Toolbar.new_button([name]) +
    +
    +
    +
    + +

    Adds a new button to the toolbar

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + when given allows an alias to the button for the permission system + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the button define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Toolbar.add_button(button) +
    +
    +
    +
    + +

    Adds an existing buttton to the toolbar

    +

    + + + Parameters: + +
      + + + + + +
    • + + button + + : + + (table) + + the button define for the button to be added + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Toolbar.update(player) +
    +
    +
    +
    + +

    Updates the player's toolbar with an new buttons or expected change in auth return

    +

    + + + Parameters: + +
      + + + + + +
    • + + player + + : + + (LuaPlayer) + + the player to update the toolbar for + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +

    Core

    +
    +
    +
    +
    + # + utils.gui +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + new_define(prototype[, debug_name]) +
    +
    +
    +
    + +

    Used to create new element defines from a class prototype, please use the own given by the class

    +

    + + + Parameters: + +
      + + + + + +
    • + + prototype + + : + + (table) + + the class prototype that will be used for the element define + +
    • + + + + + +
    • + + debug_name + + : + + (string) + + the name that you want to see while debuging + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new element define with all functions accessed via __index metamethod +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + get_define(name[, internal]) +
    +
    +
    +
    + +

    Gets an element define give the uid, debug name or a copy of the element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string or table) + + the uid, debug name or define for the element define to get + +
    • + + + + + +
    • + + internal + + : + + (boolean) + + when true the error trace is one level higher (used internally) + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the element define that was found or an error +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + categorize_by_player(element) +
    +
    +
    +
    + +

    A categorize function to be used with add_store, each player has their own value

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element that will be converted to a string + +
    • + + +
    + + + + + Returns: +
    • (string) - the path of the element that the search stoped at -
    • -
    -
    Or
    -
      -
    • - (boolean) - if the element was found, found -
    • -
    • - (LuaGuiElement) - the element that was found + the player's name who owns this element
    @@ -3583,26 +4533,24 @@ Gui.get_concept('button') - Usage: -
    -- Getting the center gui
    -local exists, center = Gui.find(player,'gui','center')
    - # - exists + # + categorize_by_force(element)
    -

    Checks if a gui element exists or not, returns it if found else the path where it failed

    +

    A categorize function to be used with add_store, each force has its own value

    + Parameters:
      @@ -3610,7 +4558,7 @@ Gui.get_concept('button') -
    • +
    • element @@ -3618,23 +4566,7 @@ Gui.get_concept('button') (LuaGuiElement) - the root element to start checking from - -
    • - - - - - -
    • - - ... - - : - - (string or table) - - element names or element concepts that point to your element + the element that will be converted to a string
    • @@ -3644,20 +4576,150 @@ Gui.get_concept('button') + Returns: +
        +
      • + (string) + the player's force name who owns this element +
      • +
      + + + + + + + + + +
    +
    +
    +
    + # + categorize_by_surface(element) +
    +
    +
    +
    + +

    A categorize function to be used with add_store, each surface has its own value

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element that will be converted to a string + +
    • + + +
    + + + + + Returns: +
      +
    • + (string) + the player's surface name who owns this element +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + draw(name, element) +
    +
    +
    +
    + +

    Draws a copy of the element define to the parent element, see draw_to

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string or table) + + the uid, debug name or define for the element define to draw + +
    • + + + + + +
    • + + element + + : + + (LuaGuiEelement) + + the parent element that it the define will be drawn to + +
    • + + +
    + + + + + Returns: + - See also: - - Usage: -
    -- Getting the center gui
    -local exists, center = Gui.exists(player,'gui','center')
    @@ -3671,7 +4733,7 @@ Gui.get_concept('button')
    -

    Toggles the enabled state of an element

    +

    Will toggle the enabled state of an element

    @@ -3691,7 +4753,7 @@ Gui.get_concept('button') (LuaGuiElement) - the element that you want to toggle the enabled state of + the gui element to toggle @@ -3705,7 +4767,7 @@ Gui.get_concept('button')
    • (boolean) - the new enabled state of the element + the new state that the element has
    @@ -3715,9 +4777,6 @@ Gui.get_concept('button') - Usage: -
    -- Toggle the enabled state of an element
    -Gui.toggle_enabled(element)
    @@ -3731,7 +4790,7 @@ Gui.get_concept('button')
    -

    Toggles the visible state of an element

    +

    Will toggle the visiblity of an element

    @@ -3751,7 +4810,7 @@ Gui.get_concept('button') (LuaGuiElement) - the element that you want to toggle the visible state of + the gui element to toggle @@ -3765,7 +4824,7 @@ Gui.get_concept('button')
    • (boolean) - the new visible state of the element + the new state that the element has
    @@ -3775,9 +4834,6 @@ Gui.get_concept('button') - Usage: -
    -- Toggle the visible state of an element
    -Gui.toggle_visible(element)
    @@ -3825,9 +4881,9 @@ Gui.get_concept('button') : - (number or boolean) + (number) - the amount of padding on the top, true leaves unchanged + the amount of padding on the top (default: 0) @@ -3842,9 +4898,9 @@ Gui.get_concept('button') : - (number or boolean) + (number) - the amount of padding on the bottom, true leaves unchanged + the amount of padding on the bottom (default: 0) @@ -3859,9 +4915,9 @@ Gui.get_concept('button') : - (number or boolean) + (number) - the amount of padding on the left, true leaves unchanged + the amount of padding on the left (default: 0) @@ -3876,9 +4932,9 @@ Gui.get_concept('button') : - (number or boolean) + (number) - the amount of padding on the right, true leaves unchanged + the amount of padding on the right (default: 0) @@ -3896,368 +4952,537 @@ Gui.get_concept('button') - Usage: -
    -- Remove all padding of an element
    -Gui.set_padding(element)
    -
    -- Remove side padding but keep vertical padding
    -Gui.set_padding(element,true,true)
    -
    -- Remove all padding but set right to 2
    -Gui.set_padding(element,false,false,false,2)
    + + + +
    +
    +
    + # + set_padding_style(style[, up=0][, down=0][, left=0][, right=0]) +
    +
    +
    +
    + +

    Sets the padding for a gui style

    +

    + + + Parameters: + +
      + + + + + +
    • + + style + + : + + (LuaStyle) + + the element to set the padding for + +
    • + + + + + +
    • + + up + + : + + (number) + + the amount of padding on the top + + (default: 0) +
    • + + + + + +
    • + + down + + : + + (number) + + the amount of padding on the bottom + + (default: 0) +
    • + + + + + +
    • + + left + + : + + (number) + + the amount of padding on the left + + (default: 0) +
    • + + + + + +
    • + + right + + : + + (number) + + the amount of padding on the right + + (default: 0) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + create_alignment(element[, name][, horizontal_align='right'][, vertical_align='center']) +
    +
    +
    +
    + +

    Allows the creation of an alignment flow to place elements into

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element to add this alignment into + +
    • + + + + + +
    • + + name + + : + + (string) + + the name to use for the alignment + + (optional) +
    • + + + + + +
    • + + horizontal_align + + : + + (string) + + the horizontal alignment of the elements in this flow + + (default: 'right') +
    • + + + + + +
    • + + vertical_align + + : + + (string) + + the vertical alignment of the elements in this flow + + (default: 'center') +
    • + + +
    + + + + + Returns: + + + + + + + + + + +
    +
    +
    +
    + # + destroy_if_valid(element) +
    +
    +
    +
    + +

    Destroies an element but tests for it being present and valid first

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element to be destroied + +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + true if it was destoried +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + create_scroll_table(element, table_size, maximal_height[, name='scroll']) +
    +
    +
    +
    + +

    Creates a scroll area with a table inside, table can be any size

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element to add this scroll into + +
    • + + + + + +
    • + + table_size + + : + + (number) + + the number of columns in the table + +
    • + + + + + +
    • + + maximal_height + + : + + (number) + + the max hieght of the scroll + +
    • + + + + + +
    • + + name + + : + + (string) + + the name of the scoll element + + (default: 'scroll') +
    • + + +
    + + + + + Returns: + + + + + + + + + + +
    +
    +
    +
    + # + create_header(element, caption[, tooltip][, right_align][, name='header']) +
    +
    +
    +
    + +

    Creates a header section with a label and button area

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element to add this header into + +
    • + + + + + +
    • + + caption + + : + + (localeString) + + the caption that is used as the title + +
    • + + + + + +
    • + + tooltip + + : + + (localeString) + + the tooltip that is shown on the caption + + (optional) +
    • + + + + + +
    • + + right_align + + : + + (boolean) + + when true will include the right align area + + (optional) +
    • + + + + + +
    • + + name + + : + + (string) + + the name of the header area + + (default: 'header') +
    • + + +
    + + + + + Returns: +
      +
    • + (LuaGuiElement) + the header that was made, or the align area if that was created +
    • +
    + + + + + + +
    -

    Store Categories

    +

    Buttons

    - # - categorize_by_player(element) + # + mod-gui
    -

    A categorize function to be used with add_store, each player has their own category

    -

    - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the element that will be converted to a string - -
    • - - -
    - - - - - Returns: -
      -
    • - (string) - the player's name who owns this element -
    • -
    - - - - - - - - Usage: -
    -- Storing data on a per player basis, can be used with instances
    -Gui.get_concept('CustomButton')
    -:define_data_store(Gui.categorize_by_player)
    - - -
    -
    -
    -
    - # - categorize_by_force(element) -
    -
    -
    -
    - -

    A categorize function to be used with add_store, each force has its own category

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the element that will be converted to a string - -
    • - - -
    - - - - - Returns: -
      -
    • - (string) - the player's force name who owns this element -
    • -
    - - - - - - - - Usage: -
    -- Storing data on a per force basis, can be used with instances
    -Gui.get_concept('CustomButton')
    -:define_data_store(Gui.categorize_by_force)
    - - -
    -
    -
    -
    - # - categorize_by_surface(element) -
    -
    -
    -
    - -

    A categorize function to be used with add_store, each surface has its own category

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the element that will be converted to a string - -
    • - - -
    - - - - - Returns: -
      -
    • - (string) - the player's surface name who owns this element -
    • -
    - - - - - - - - Usage: -
    -- Storing data on a per surface basis, can be used with instances
    -Gui.get_concept('CustomButton')
    -:define_data_store(Gui.categorize_by_surface)
    - - -
    -
    -

    Concept Base

    -
    -
    -
    -
    - # - Prototype:clone(concept_name) -
    -
    -
    -
    - -

    Used to copy all the settings from one concept to another and removing links to the orginal

    -

    - - - Parameters: - -
      - - - - - -
    • - - concept_name - - : - - (string) - - the name of the new concept; must be unique - -
    • - - -
    - - - - - Returns: -
      -
    • - (GuiConcept) - the base for building a custom gui -
    • -
    - - - - - - - - Usage: -
    -- Clones the base Button concept to make a alternative button
    -local custom_button =
    -Gui.get_concept(Gui.concepts.button):clone()
    - - -
    -
    -
    -
    - # - Prototype:define_clone(clone_callback) -
    -
    -
    -
    - -

    Use to add your own callbacks to the clone function, for example adding to a local table

    -

    - - - Parameters: - -
      - - - - - -
    • - - clone_callback - - : - - (function) - - the function which is called with the concept to have something done to it - -
    • - - -
    - - - - - Returns: -
      -
    • - (table) - self to allow chaining -
    • -
    - - - - - - - - Usage: -
    -- Adding concept to a local table
    -local buttons = {}
    -local button =
    -Gui.get_concept('Button')
    -:define_clone(function(concept)
    -    buttons[concept.name] = concept
    -end)
    - - -
    -
    -
    -
    - # - Prototype:save_as(save_name) -
    -
    -
    -
    - -

    Used to save the concept to the main gui module to allow access from other files

    -

    - - - Parameters: - -
      - - - - - -
    • - - save_name - - : - - (string) - - the new name of the concept - -
    • - - -
    - @@ -4268,26 +5493,70 @@ Gui.get_concept('Button') - Usage: -
    -- Save a concept to allow access in another file
    -button:save_as('button')
    -
    -- Access concept after being saved
    -Gui.concepts.button
    -Gui.get_concept('button')
    - # - Prototype:debug(name) + # + expcore.gui.core
    -

    Sets a debug name that can be used with error handlers

    + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Button.new_button([name]) +
    +
    +
    +
    + +

    Creates a new button element define

    @@ -4307,7 +5576,539 @@ Gui.get_concept('button') (string) - the name that will be used in error messages + the optional debug name that can be added + + (optional) + + + + + + + + + Returns: +
      +
    • + (table) + the new button element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Button._prototype:set_sprites(sprite[, hovered_sprite][, clicked_sprite]) +
    +
    +
    +
    + +

    Adds sprites to a button making it a sprite button

    +

    + + + Parameters: + +
      + + + + + +
    • + + sprite + + : + + (SpritePath) + + the sprite path for the default sprite for the button + +
    • + + + + + +
    • + + hovered_sprite + + : + + (SpritePath) + + the sprite path for the sprite when the player hovers over the button + + (optional) +
    • + + + + + +
    • + + clicked_sprite + + : + + (SpritePath) + + the sprite path for the sprite when the player clicks the button + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + returns the button define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Button._prototype:set_click_filter(filter[, ...]) +
    +
    +
    +
    + +

    Adds a click / mouse button filter to the button

    +

    + + + Parameters: + +
      + + + + + +
    • + + filter + + : + + (table) + + ?string|table either a of mouse buttons or the first mouse button to filter, with a table true means allowed + +
    • + + + + + +
    • + + ... + + : + + (table) + + when filter is not a you can add the mouse buttons one after each other + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + returns the button define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Button._prototype:set_key_filter(filter[, ...]) +
    +
    +
    +
    + +

    Adds a control key filter to the button

    +

    + + + Parameters: + +
      + + + + + +
    • + + filter + + : + + (table) + + ?string|table either a of control keys or the first control keys to filter, with a table true means allowed + +
    • + + + + + +
    • + + ... + + : + + (table) + + when filter is not a you can add the control keys one after each other + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + returns the button define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +

    Checkboxs

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.store +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Checkbox.new_checkbox([name]) +
    +
    +
    +
    + +

    Creates a new checkbox element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new checkbox element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Checkbox.new_radiobutton([name]) +
    +
    +
    +
    + +

    Creates a new radiobutton element define, has all functions checkbox has

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new button element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Checkbox._prototype_radiobutton:add_as_option(option_set, option_name) +
    +
    +
    +
    + +

    Adds this radiobutton to be an option in the given option set (only one can be true at a time)

    +

    + + + Parameters: + +
      + + + + + +
    • + + option_set + + : + + (string) + + the name of the option set to add this element to + +
    • + + + + + +
    • + + option_name + + : + + (string) + + the name of this option that will be used to identify it
    • @@ -4321,7 +6122,7 @@ Gui.get_concept('button')
      • (self) - to allow chaining + the define to allow chaining
      @@ -4331,23 +6132,3615 @@ Gui.get_concept('button') - Usage: -
      -- Set the debug name
      -unsaved_concept:debug('Example button')
    - # - Prototype:new_event(event_name[, factorio_event][, event_condition]) + # + Checkbox._prototype_radiobutton:get_store(category, internal)
    -

    Adds a new event trigger to the concept which can be linked to a factorio event

    +

    Gets the stored value of the radiobutton or the option set if present

    +

    + + + Parameters: + +
      + + + + + +
    • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
    • + + + + + +
    • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
    • + + +
    + + + + + Returns: +
      +
    • + (any) + the value that is stored for this define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Checkbox._prototype_radiobutton:set_store(category, value, internal) +
    +
    +
    +
    + +

    Sets the stored value of the radiobutton or the option set if present

    +

    + + + Parameters: + +
      + + + + + +
    • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
    • + + + + + +
    • + + value + + : + + (boolean) + + the value to set for this define, must be valid for its type ie for checkbox etc + +
    • + + + + + +
    • + + internal + + : + + (boolean) + + used to prevent stackover flow + +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + true if the value was set +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Checkbox.new_option_set(name, callback, categorize) +
    +
    +
    +
    + +

    Registers a new option set that can be linked to radiobuttons (only one can be true at a time)

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the option set, must be unique + +
    • + + + + + +
    • + + callback + + : + + (function) + + the update callback when the value of the option set changes + callback param - value string - the new selected option for this option set + callback param - category string - the category that updated if categorize was used + +
    • + + + + + +
    • + + categorize + + : + + (function) + + the function used to convert an element into a string + +
    • + + +
    + + + + + Returns: +
      +
    • + (string) + the name of this option set to be passed to add_as_option +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Checkbox.draw_option_set(name, element) +
    +
    +
    +
    + +

    Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the option set to draw the radiobuttons of + +
    • + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the parent element that the radiobuttons will be drawn to + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Checkbox.reset_radiobuttons(element[, exclude][, recursive=false]) +
    +
    +
    +
    + +

    Sets all radiobutton in a element to false (unless excluded) and can act recursively

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the root gui element to start setting radio buttons from + +
    • + + + + + +
    • + + exclude + + : + + (table) + + ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true + + (optional) +
    • + + + + + +
    • + + recursive + + : + + (number or boolean) + + if true will recur as much as possible, if a will recur that number of times + + (default: false) +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + true if successful +
    • +
    + + + + + + + + + +
    +
    +

    Dropdowns

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Dropdown.new_dropdown([name]) +
    +
    +
    +
    + +

    Creates a new dropdown element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new dropdown element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Dropdown.new_list_box([name]) +
    +
    +
    +
    + +

    Creates a new list box element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new list box element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Dropdown._prototype:new_static_options(options[, ...], the) +
    +
    +
    +
    + +

    Adds new static options to the dropdown which will trigger the general callback

    +

    + + + Parameters: + +
      + + + + + +
    • + + options + + : + + (table) + + ?string|table either a of option strings or the first option string, with a table values are the options + +
    • + + + + + +
    • + + ... + + : + + (table) + + when options is not a you can add the options one after each other + + (optional) +
    • + + + + + +
    • + + the + + : + + (self) + + define to allow chaining + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Dropdown._prototype:new_dynamic_options(callback) +
    +
    +
    +
    + +

    Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options)

    +

    + + + Parameters: + +
      + + + + + +
    • + + callback + + : + + (function) + + the function that will run to get the options for the dropdown + callback param - player LuaPlayer - the player that the element is being drawn to + callback param - element LuaGuiElement - the element that is being drawn + callback return - table - the values of this table will be appended to the static options of the dropdown + +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + the define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Dropdown._prototype:add_option_callback(option, callback) +
    +
    +
    +
    + +

    Adds a case specific callback which will only run when that option is selected (general case still triggered)

    +

    + + + Parameters: + +
      + + + + + +
    • + + option + + : + + (string) + + the name of the option to trigger the callback on; if not already added then will be added as an option + +
    • + + + + + +
    • + + callback + + : + + (function) + + the function that will be called when that option is selected + callback param - player LuaPlayer - the player who owns the gui element + callback param - element LuaGuiElement - the element which is being effected + callback param - value string - the new option that has been selected + +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + the define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Dropdown.select_value(element, value) +
    +
    +
    +
    + +

    Selects the option from a dropdown or list box given the value rather than key

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element that contains the option + +
    • + + + + + +
    • + + value + + : + + (string) + + the option to select from the dropdown + +
    • + + +
    + + + + + Returns: +
      +
    • + (number) + the key where the value was +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Dropdown.get_selected_value(element) +
    +
    +
    +
    + +

    Returns the currently selected value rather than index

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the gui element that you want to get the value of + +
    • + + +
    + + + + + Returns: +
      +
    • + (string) + the value that is currently selected +
    • +
    + + + + + + + + + +
    +
    +

    Elem Buttons

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + ElemButton.new_elem_button([name]) +
    +
    +
    +
    + +

    Creates a new elem button element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new elem button element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + ElemButton._prototype.set_type +
    +
    +
    +
    + +

    Sets the type of the elem button, the type is required so this must be called at least once

    +

    + + + +
      + + + + + +
    • + + type + + : + + (string) + + the type that this elem button is see factorio api + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ElemButton._prototype:set_default(value) +
    +
    +
    +
    + +

    Sets the default value for the elem button, this may be a function or a string

    +

    + + + Parameters: + +
      + + + + + +
    • + + value + + : + + (string or function) + + string a will be a static default and a function will be called when drawn to get the default + +
    • + + +
    + + + + + Returns: +
      +
    • + (the) + element define to allow for chaining +
    • +
    + + + + + + + + + +
    +
    +

    Progress Bars

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.global +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar.set_maximum(element, amount) +
    +
    +
    +
    + +

    Sets the maximum value that represents the end value of the progress bar

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
    • + + + + + +
    • + + amount + + : + + (number) + + the amount to have set as the maximum + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar.increment(element[, amount=1]) +
    +
    +
    +
    + +

    Increases the value of the progressbar, if a define is given all of its instances have incremented

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
    • + + + + + +
    • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar.decrement(element[, amount=1]) +
    +
    +
    +
    + +

    Decreases the value of the progressbar, if a define is given all of its instances have decremented

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement or string) + + either a gui element or a registered define + +
    • + + + + + +
    • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar.new_progressbar([name]) +
    +
    +
    +
    + +

    Creates a new progressbar element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new progressbar element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:set_default_maximum(amount) +
    +
    +
    +
    + +

    Sets the maximum value that represents the end value of the progress bar

    +

    + + + Parameters: + +
      + + + + + +
    • + + amount + + : + + (number) + + the amount to have set as the maximum + +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:use_count_down([state=true]) +
    +
    +
    +
    + +

    Will set the progress bar to start at 1 and trigger when it hits 0

    +

    + + + Parameters: + +
      + + + + + +
    • + + state + + : + + (boolean) + + when true the bar will start filled, to be used with decrease + + (default: true) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:increment([amount=1][, category]) +
    +
    +
    +
    + +

    Increases the value of the progressbar

    +

    + + + Parameters: + +
      + + + + + +
    • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
    • + + + + + +
    • + + category + + : + + (string) + + the category that is used with a store + + (optional) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:increment_filtered([amount=1], filter) +
    +
    +
    +
    + +

    Increases the value of the progressbar, if the filter condition is met, does not work with store

    +

    + + + Parameters: + +
      + + + + + +
    • + + amount + + : + + (number) + + the amount to increase the progressbar by + + (default: 1) +
    • + + + + + +
    • + + filter + + : + + (function) + + the filter to be used + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:decrement([amount=1][, category]) +
    +
    +
    +
    + +

    Decreases the value of the progressbar

    +

    + + + Parameters: + +
      + + + + + +
    • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
    • + + + + + +
    • + + category + + : + + (string) + + the category that is used with a store + + (optional) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:decrement_filtered([amount=1], filter) +
    +
    +
    +
    + +

    Decreases the value of the progressbar, if the filter condition is met, does not work with store

    +

    + + + Parameters: + +
      + + + + + +
    • + + amount + + : + + (number) + + the amount to decrease the progressbar by + + (default: 1) +
    • + + + + + +
    • + + filter + + : + + (function) + + the filter to be used + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:add_element(element[, maximum]) +
    +
    +
    +
    + +

    Adds an element into the list of instances that will are waiting to complete, does not work with store + note use store if you want persistent data, this only stores the elements not the values which they have

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element that you want to add into the waiting to complete list + +
    • + + + + + +
    • + + maximum + + : + + (number) + + the maximum for this element if not given the default for this define is used + + (optional) +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:reset_element(element) +
    +
    +
    +
    + +

    Resets an element, or its store, to be back at the start, either 1 or 0

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element that you want to reset the progress of + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:event_counter([filter]) +
    +
    +
    +
    + +

    Event handler factory that counts up by 1 every time the event triggers, can filter which elements have incremented

    +

    + + + Parameters: + +
      + + + + + +
    • + + filter + + : + + (function) + + when given will use filtered increment + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (function) + the event handler +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + ProgressBar._prototype:event_countdown([filter]) +
    +
    +
    +
    + +

    Event handler factory that counts down by 1 every time the event triggers, can filter which elements have decremented

    +

    + + + Parameters: + +
      + + + + + +
    • + + filter + + : + + (function) + + when given will use filtered decrement + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (function) + the event handler +
    • +
    + + + + + + + + + +
    +
    +

    Sliders

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.instances +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Slider.new_slider([name]) +
    +
    +
    +
    + +

    Creates a new slider element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new slider element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Slider._prototype:set_range([min][, max]) +
    +
    +
    +
    + +

    Sets the range of a slider, if not used will use default values for a slider

    +

    + + + Parameters: + +
      + + + + + +
    • + + min + + : + + (number) + + the minimum value that the slider can take + + (optional) +
    • + + + + + +
    • + + max + + : + + (number) + + the maximum value that the slider can take + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + the define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Slider._prototype:draw_label(element) +
    +
    +
    +
    + +

    Draws a new label and links its value to the value of this slider, if no store then it will only show one value per player

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the parent element that the label will be drawn to + +
    • + + +
    + + + + + Returns: +
      +
    • + (LuaGuiElement) + the new label element so that styles can be applied +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Slider._prototype:enable_auto_draw_label([state=true]) +
    +
    +
    +
    + +

    Enables auto draw of the label, the label will share the same parent element as the slider

    +

    + + + Parameters: + +
      + + + + + +
    • + + state + + : + + (boolean) + + when false will disable the auto draw of the label + + (default: true) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + the define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +

    Text

    +
    +
    +
    +
    + # + expcore.gui.core +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.prototype +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Text.new_text_field([name]) +
    +
    +
    +
    + +

    Creates a new text field element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new text field element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Text.new_text_box([name]) +
    +
    +
    +
    + +

    Creates a new text box element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the optional debug name that can be added + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the new text box element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Text._prototype_box:set_selectable([state=true]) +
    +
    +
    +
    + +

    Sets the text box to be selectable

    +

    + + + Parameters: + +
      + + + + + +
    • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + table the define to allow for chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Text._prototype_box:set_word_wrap([state=true]) +
    +
    +
    +
    + +

    Sets the text box to have word wrap

    +

    + + + Parameters: + +
      + + + + + +
    • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + table the define to allow for chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Text._prototype_box:set_read_only([state=true]) +
    +
    +
    +
    + +

    Sets the text box to be read only

    +

    + + + Parameters: + +
      + + + + + +
    • + + state + + : + + (boolean) + + when false will set the state to false + + (default: true) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + table the define to allow for chaining +
    • +
    + + + + + + + + + +
    +
    +

    Instances

    +
    +
    +
    +
    + # + utils.global +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Instances.has_categories(name) +
    +
    +
    +
    + +

    Returns if a instance group has a categorise function; must be registered

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group + +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + true if there is a categorise function +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Instances.is_registered(name) +
    +
    +
    +
    + +

    Returns if the given name is a registered instance group

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group you are testing + +
    • + + +
    + + + + + Returns: +
      +
    • + (boolean) + true if the name is registered +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Instances.register(name[, categorise]) +
    +
    +
    +
    + +

    Registers the name of an instance group to allow for storing element instances

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group; must to unique + +
    • + + + + + +
    • + + categorise + + : + + (function) + + function used to turn the element into a string + categorise param - element LuaGuiElement - the gui element to be turned into a string + categorise return - string - the category that the element will be added to like the player's name or force's name + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (string) + the name that was added so it can be used as a variable +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Instances.add_element(name, element) +
    +
    +
    +
    + +

    Adds an element to the instance group under the correct category; must be registered

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group to add the element to + +
    • + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element to add the the instance group + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Instances.get_elements_raw(name[, category]) +
    +
    +
    +
    + +

    Gets all element instances without first removing any invalid ones; used internally and must be registered

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group to get the instances of + +
    • + + + + + +
    • + + category + + : + + (string) + + the category to get the instance from, not needed when no categorise function + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the table of element instances of which some may be invalid +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Instances.get_valid_elements(name[, category][, callback]) +
    +
    +
    +
    + +

    Gets all valid element instances and has the option of running a callback on those that are valid

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group to get the instances of + +
    • + + + + + +
    • + + category + + : + + (string) + + the category to get the instances of, not needed when no categorise function + + (optional) +
    • + + + + + +
    • + + callback + + : + + (function) + + when given the callback will be ran on all valid elements + callback param - element LuaGuiElement - the current valid element + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the table of element instances with all invalid ones removed +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Instances.unregistered_add_element(name, category, element) +
    +
    +
    +
    + +

    A version of add_element that does not require the group to be registered

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group to add the element to + +
    • + + + + + +
    • + + category + + : + + (string or nil) + + the category to add the element to, can be nil but must still be given + +
    • + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element to add to the instance group + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Instances.unregistered_get_elements(name, category[, callback]) +
    +
    +
    +
    + +

    A version of get_elements that does not require the group to be registered

    +

    + + + Parameters: + +
      + + + + + +
    • + + name + + : + + (string) + + the name of the instance group to get the instances of + +
    • + + + + + +
    • + + category + + : + + (string or nil) + + the category to get the instances of, can be nil but must still be given + +
    • + + + + + +
    • + + callback + + : + + (function) + + when given will be called on all valid instances + callback param - element LuaGuiElement - the current valid element + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (table) + the table of element instances with all invalid ones removed +
    • +
    + + + + + + + + + +
    +
    +

    Prototype

    +
    +
    +
    +
    + # + utils.game +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.store +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.gui.instances +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + Constructor.event(event_name) +
    +
    +
    +
    + +

    Creates a new function to add functions to an event handler

    @@ -4367,45 +9760,11 @@ Gui.get_concept('button') (string) - the name of the event to add, must be unique, recomented to start with "on_" + the name of the event that callbacks will be added to - - - -
  • - - factorio_event - - : - - (defines.events) - - when given will fire the custom event when the factorio event is raised - - (optional) -
  • - - - - - -
  • - - event_condition - - : - - (function) - - used to filter when a factorio event triggers the custom event; if the event contains a reference to an element then names are automatically filtered - - (optional) -
  • - - @@ -4414,8 +9773,8 @@ Gui.get_concept('button') Returns:
    • - (GuiConcept) - to allow chaining of functions + (function) + the function used to register handlers
    @@ -4425,27 +9784,20 @@ Gui.get_concept('button') - Usage: -
    -- Adds an on_admin_clicked event to fire when ever an admin clicks the button
    -local custom_button =
    -Gui.get_concept('Button'):clone('CustomButton')
    -:new_event('on_admin_clicked',defines.events.on_gui_click,function(event)
    -    return event.player.admin -- only raise custom event when an admin clicks the button
    -end)
    - # - Prototype:on_custom_event(handler) + # + Constructor.extend(new_prototype)
    -

    Adds a custom event handler, replace with the name of the event

    +

    Extents a prototype with the base functions of all gui prototypes, no metatables

    @@ -4459,13 +9811,13 @@ Gui.get_concept('Button'):clone( - handler + new_prototype : - (function) + (table) - the function which will recive the event + the prototype that you want to add the functions to @@ -4478,8 +9830,689 @@ Gui.get_concept('Button'):clone(Returns:
    • - (GuiConcept) - to allow chaining of functions + (table) + the same prototype but with the new functions added +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Constructor.store(sync, callback) +
    +
    +
    +
    + +

    Creates a new function which adds a store to a gui define

    +

    + + + Parameters: + +
      + + + + + +
    • + + sync + + : + + (boolean) + + if the function should create a synced store + +
    • + + + + + +
    • + + callback + + : + + (function) + + the function called when needing to update the value of an element + +
    • + + +
    + + + + + Returns: +
      +
    • + (function) + the function that will add a store for this define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Constructor.setter(value_type, key[, second_key]) +
    +
    +
    +
    + +

    Creates a setter function that checks the type when a value is set

    +

    + + + Parameters: + +
      + + + + + +
    • + + value_type + + : + + (string) + + the type that the value should be when it is set + +
    • + + + + + +
    • + + key + + : + + (string) + + the key of the define that will be set + +
    • + + + + + +
    • + + second_key + + : + + (string) + + allows for setting of a key in a sub table + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (function) + the function that will check the type and set the value +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Prototype:uid() +
    +
    +
    +
    + +

    Gets the uid for the element define

    +

    + + + + + + Returns: +
      +
    • + (string) + the uid of this element define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Prototype.debug_name +
    +
    +
    +
    + +

    Sets a debug alias for the define

    +

    + + + +
      + + + + + +
    • + + name + + : + + (string) + + the debug name for the element define that can be used to get this element define + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Prototype.set_caption +
    +
    +
    +
    + +

    Sets the caption for the element define

    +

    + + + +
      + + + + + +
    • + + caption + + : + + (string) + + the caption that will be drawn with the element + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Prototype.set_tooltip +
    +
    +
    +
    + +

    Sets the tooltip for the element define

    +

    + + + +
      + + + + + +
    • + + tooltip + + : + + (string) + + the tooltip that will be displayed for this element when drawn + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Prototype.set_pre_authenticator +
    +
    +
    +
    + +

    Sets an authenticator that blocks the draw function if check fails

    +

    + + + +
      + + + + + +
    • + + callback + + : + + (function) + + the function that will be ran to test if the element should be drawn or not + callback param - LuaPlayer player - the player that the element is being drawn to + callback param - string define_name - the name of the define that is being drawn + callback return - boolean - false will stop the element from being drawn + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Prototype.set_post_authenticator +
    +
    +
    +
    + +

    Sets an authenticator that disables the element if check fails

    +

    + + + +
      + + + + + +
    • + + callback + + : + + (function) + + the function that will be ran to test if the element should be enabled or not + callback param - LuaPlayer player - the player that the element is being drawn to + callback param - string define_name - the name of the define that is being drawn + callback return - boolean - false will disable the element + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Prototype.on_draw +
    +
    +
    +
    + +

    Registers a callback to the on_draw event

    +

    + + + +
      + + + + + +
    • + + callback + + : + + (function) + + + callback param - LuaPlayer player - the player that the element was drawn to + callback param - LuaGuiElement element - the element that was drawn + callback param - any ... - any other params passed by the draw_to function + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Prototype.on_style_update +
    +
    +
    +
    + +

    Registers a callback to the on_style_update event

    +

    + + + +
      + + + + + +
    • + + callback + + : + + (function) + + + callback param - LuaStyle style - the style that was changed and/or needs changing + +
    • + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    + # + Prototype:set_style(style[, callback]) +
    +
    +
    +
    + +

    Sets the style for the element define

    +

    + + + Parameters: + +
      + + + + + +
    • + + style + + : + + (string) + + the style that will be used for this element when drawn + +
    • + + + + + +
    • + + callback + + : + + (function) + + function is called when element is drawn to alter its style + + (optional) +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + the element define to allow chaining +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Prototype:set_embedded_flow(state) +
    +
    +
    +
    + +

    Sets the element to be drawn inside a nameless flow, can be given a name using a function

    +

    + + + Parameters: + +
      + + + + + +
    • + + state + + : + + (boolean or function) + + when true a padless flow is created to contain the element + +
    • + + +
    + + + + + Returns: +
      +
    • + (self) + the element define to allow chaining
    @@ -4489,13 +10522,6 @@ Gui.get_concept('Button'):clone( - Usage: -
    -- When an admin clicks the button a message is printed
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -:on_admin_clicked(function(event)
    -    game.print(event.player.name..' pressed my admin button')
    -end)
    @@ -4503,13 +10529,13 @@ Gui.get_concept('CustomButton')
    # - Prototype:raise_event(event_name[, event={}][, from_factorio=false]) + Prototype:raise_event(event_name, ...)
    -

    Raises a custom event, folowing keys included automaticlly: concept, event name, game tick, player from player_index, element if valid

    +

    Raises a custom event for this define, any number of params can be given

    @@ -4539,15 +10565,186 @@ Gui.get_concept('CustomButton')
  • - event + ... : - (table) + (any) - table containg data you want to send with the event, some keys already included + any params that you want to pass to the event + +
  • + + + + + + + + Returns: +
      +
    • + (number) + the number of handlers that were registered +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Prototype:draw_to(element) +
    +
    +
    +
    + +

    The main function for defines, when called will draw an instance of this define to the given element + what is drawn is based on the data in draw_data which is set using other functions

    +

    + + + Parameters: + +
      + + + + + +
    • + + element + + : + + (LuaGuiElement) + + the element that the define will draw a instance of its self onto + +
    • + + +
    + + + + + Returns: + + + + + + + + + + +
    +
    +
    +
    + # + Prototype:get_store(category) +
    +
    +
    +
    + +

    Gets the value in this elements store, category needed if categorize function used

    +

    + + + Parameters: + +
      + + + + + +
    • + + category + + : + + (string) + + [opt] the category to get such as player name or force name + +
    • + + +
    + + + + + Returns: +
      +
    • + (any) + the value that is stored for this define +
    • +
    + + + + + + + + + +
    +
    +
    +
    + # + Prototype:set_store(category, value) +
    +
    +
    +
    + +

    Sets the value in this elements store, category needed if categorize function used

    +

    + + + Parameters: + +
      + + + + + +
    • + + category + + : + + (string) + + [opt] the category to get such as player name or force name - (default: {})
    • @@ -4556,122 +10753,27 @@ Gui.get_concept('CustomButton')
    • - from_factorio + value : + (any) + + the value to set for this define, must be valid for its type ie for checkbox etc + +
    • + + +
    + + + + + Returns: +
      +
    • (boolean) - - internal use, if the raise came from the factorio event handler - - (default: false) -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Raising the custom event on_admin_clicked
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    --- Note that this is an example and would not work due it expecting a valid element for event.element
    --- this will however work fine if you can provide all expected keys, or its not linked to any factorio event
    -custom_button:raise_event('on_admin_clicked',{
    -    player_index = game.player.index
    -})
    - - -
    -
    -
    -
    - # - Prototype:new_property(property_name[, setter_callback][, default]) -
    -
    -
    -
    - -

    Adds a new property to the concept, such as caption, tooltip, or some custom property you want to control

    -

    - - - Parameters: - -
      - - - - - -
    • - - property_name - - : - - (string) - - the name of the new property, must be unique - -
    • - - - - - -
    • - - setter_callback - - : - - (function) - - this function is called when set is called, if not provided then key in concept.properties is updated to new value - - (optional) -
    • - - - - - -
    • - - default - - : - - (any) - - use this as the default value, will call the setter callback if defined - - (optional) -
    • - - -
    - - - - - Returns: -
      -
    • - (GuiConcept) - to allow chaining of functions + true if the value was set
    @@ -4681,35 +10783,20 @@ Gui.get_concept('CustomButton') - Usage: -
    -- Adding caption, sprite, and tooltip to the base button concept
    -local button =
    -Gui.get_concept('Button')
    -:new_property('tooltip')
    -:new_property('caption',nil,function(properties,value)
    -    properties.caption = value
    -    properties.sprite = nil
    -    properties.type = 'button'
    -end)
    -:new_property('sprite',nil,function(properties,value)
    -    properties.image = value
    -    properties.caption = nil
    -    properties.type = 'sprite-button'
    -end)
    - # - Prototype:set_custom_property(value) + # + Prototype:clear_store([category])
    -

    Sets a new value for a property, triggers setter method if provided, replace with property name

    +

    Sets the value in this elements store to nil, category needed if categorize function used

    @@ -4721,391 +10808,6 @@ Gui.get_concept('Button') -
  • - - value - - : - - (any) - - the value that you want to set for this property - -
  • - - - - - - - - Returns: -
      -
    • - (GuiConcept) - to allow chaining of functions -
    • -
    - - - - - - - - Usage: -
    -- Setting the caption on the base button concept after a cloning
    -local custom_button =
    -Gui.get_concept('Button')
    -:set_caption('Default Button')
    -
    -- In our examples CustomButton is cloned from Button, this means the caption property already exists
    --- note that what ever values that properties have at the time of cloning are also copied
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -:set_caption('Custom Button')
    - - -
    -
    -
    -
    - # - Prototype:define_draw(draw_callback) -
    -
    -
    -
    - -

    Used to define how the concept is turned into an ingame element or "instance" as we may refer to them

    -

    - - - Parameters: - -
      - - - - - -
    • - - draw_callback - - : - - (function) - - the function that will be called to draw/update the instance; this function must return the instance or the new acting instance - -
    • - - -
    - - - - - Returns: -
      -
    • - (GuiConcept) - to allow chaining of functions -
    • -
    - - - - - - - - Usage: -
    -- Adding the draw define for the base button concept, we then return the element
    -local button =
    -Gui.get_concept('Button')
    -:define_draw(function(properties,parent,element)
    -    -- Properties will include all the information that you need to draw the element
    -    -- Parent is the parent element for the element, this may have been altered by previous draw functions
    -    -- Element is the current element being made, this may have a nil value, if it is nil then this is the first draw function
    -    -- You can also pass any other arguments that you want to this function from the draw call
    -    if properties.type == 'button' then
    -        element = parent.add{
    -            type = properties.type,
    -            name = properties.name,
    -            caption = properties.caption,
    -            tooltip = properties.tooltip
    -        }
    -
    -    else
    -        element = parent.add{
    -            type = properties.type,
    -            name = properties.name,
    -            sprite = properties.sprite,
    -            tooltip = properties.tooltip
    -        }
    -
    -    end
    -
    -    -- If you return element or parent then their values will be updated for the next draw function in the chain
    -    -- It is best practice to always return the values if you have made any changes to them
    -    return element, parent
    -end)
    - - -
    -
    -
    -
    - # - Prototype:draw(parent_element[, override_name]) -
    -
    -
    -
    - -

    Calls all the draw functions in order to create this concept in game; will also store and sync the instance if stores are used

    -

    - - - Parameters: - -
      - - - - - -
    • - - parent_element - - : - - (LuaGuiElement) - - the element that the concept will use as a base - -
    • - - - - - -
    • - - override_name - - : - - (string) - - when given this will be the name of the element rather than the concept id - - (optional) -
    • - - -
    - - - - - Returns: -
      -
    • - (LuaGuiElement) - the element that was created and then passed though and returned by the draw functions -
    • -
    - - - - - - - - Usage: -
    -- Drawing the custom button concept
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    --- Note that the draw function from button was cloned, so unless we want to alter the base button we dont need a new draw define
    -custom_button:draw(game.player.gui.left)
    - - -
    -
    -

    Concept Instances

    -
    -
    -
    -
    - # - Prototype:define_instance_store([category_callback]) -
    -
    -
    -
    - -

    Adds an instance store to the concept; when a new instance is made it is stored so you can access it later

    -

    - - - Parameters: - -
      - - - - - -
    • - - category_callback - - : - - (function) - - when given will act as a way to turn an element into a string to act as a key; keys returned can over lap - - (optional) -
    • - - -
    - - - - - Returns: -
      -
    • - (GuiConcept) - to allow chaining of functions -
    • -
    - - - - - - - - Usage: -
    -- Allowing storing instances of the custom button; stored by the players index
    --- Note even thou this is a copy of Button; if Button had an instance store it would not be cloned over
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -:define_instance_store(function(element)
    -    return element.player_index -- The instances are stored based on player id
    -end)
    - - -
    -
    -
    -
    - # - Prototype.get_instances([category]) -
    -
    -
    -
    - -

    Gets all insatnces in a category, category may be nil to return all

    -

    - - - Parameters: - -
      - - - - - -
    • - - category - - : - - (string or LuaGuiElement) - - the category to get, can only be nil if categories are not used - - (optional) -
    • - - -
    - - - - - Returns: -
      -
    • - (table) - a table which contains all the instances -
    • -
    - - - - - - - - Usage: -
    -- Getting all the instances of the player with index 1
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    -custom_button.get_instances(1) -- player index 1
    - - -
    -
    -
    -
    - # - Prototype.add_instance(element[, category]) -
    -
    -
    -
    - -

    Adds an instance to this concept, used automatically during concept:draw

    -

    - - - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the element that will be added as an instance - -
    • - - - - -
    • category @@ -5114,142 +10816,7 @@ custom_button.get_instances(1) -- player index string) - the category to add this element under, if nil the category callback is used to assign one - - (optional) -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Adding an element as a instance for this concept, mostly for internal use
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    -custom_button.add_instance(element) -- normally not needed due to use in concept:draw
    - - -
    -
    -
    -
    - # - Prototype.update_instances([category], update_callback) -
    -
    -
    -
    - -

    Applies an update function to all instances, simialr use to what table.forEach would be

    -

    - - - Parameters: - -
      - - - - - -
    • - - category - - : - - (string or LuaGuiElement) - - the category to get, can only be nil if categories are not used - - (optional) -
    • - - - - - -
    • - - update_callback - - : - - (function) - - the function which is called on each instance, recives other args passed to update_instances - -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Changing the font color of all instances for player 1
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    -custom_button.update_instances(1,function(element)
    -    element.style.font_color = {r=1,g=0,b=0}
    -end)
    - - -
    -
    -

    Concept Data

    -
    -
    -
    -
    - # - Prototype:define_data_store([category_callback]) -
    -
    -
    -
    - -

    Adds a data store to this concept which allows you to store synced/percistent data between instances

    -

    - - - Parameters: - -
      - - - - - -
    • - - category_callback - - : - - (function) - - when given will act as a way to turn an element into a string to act as a key; keys returned can over lap + the category to get such as player name or force name (optional)
    • @@ -5263,8 +10830,8 @@ custom_button.update_instances(1,GuiConcept) - to allow chaining of functions + (boolean) + true if the value was set
    @@ -5274,364 +10841,27 @@ custom_button.update_instances(1,-- Adding a way to store data for this concept; each player has their own store --- Note even thou this is a copy of Button; if Button had an data store it would not be cloned over -local custom_button = -Gui.get_concept('CustomButton') -:define_data_store(function(element) - return element.player_index -- The data is stored based on player id -end) - - -
    -
    -
    -
    - # - Prototype.get_data([category]) -
    -
    -
    -
    - -

    Gets the data that is stored for this category

    -

    - - - Parameters: - -
      - - - - - -
    • - - category - - : - - (string or LuaGuiElement) - - the category to get, can only be nil if categories are not used - - (optional) -
    • - - -
    - - - - - Returns: -
      -
    • - (any) - the data that you had stored in this location -
    • -
    - - - - - - - - Usage: -
    -- Getting the stored data for player 1
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    -custom_button.get_data(1) -- player index 1
    - - -
    -
    -
    -
    - # - Prototype.set_data([category], value) -
    -
    -
    -
    - -

    Sets the data that is stored for this category

    -

    - - - Parameters: - -
      - - - - - -
    • - - category - - : - - (string or LuaGuiElement) - - the category to set, can only be nil if categories are not used - - (optional) -
    • - - - - - -
    • - - value - - : - - (any) - - the data that you want to stored in this location - -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Setting the data for player 1 to a table with two keys
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    --- A table is used to show correct way to use a table with self.update_data
    --- but a table is not required and can be any data, however upvalues may cause desyncs
    -custom_button.set_data(1,{
    -    clicks = 0,
    -    required_clicks = 100
    -}) -- player index 1
    - - -
    -
    -
    -
    - # - Prototype.clear_data([category]) -
    -
    -
    -
    - -

    Clears the data that is stored for this category

    -

    - - - Parameters: - -
      - - - - - -
    • - - category - - : - - (string or LuaGuiElement) - - the category to clear, can only be nil if categories are not used - - (optional) -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Clearing the data for player 1
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    -custom_button.clear_data(1) -- player index 1
    - - -
    -
    -
    -
    - # - Prototype.update_data([category], update_callback) -
    -
    -
    -
    - -

    Updates the data that is stored for this category

    -

    - - - Parameters: - -
      - - - - - -
    • - - category - - : - - (string or LuaGuiElement) - - the category to clear, can only be nil if categories are not used - - (optional) -
    • - - - - - -
    • - - update_callback - - : - - (function) - - the function which is called to update the data - -
    • - - -
    - - - - - - - - - - - - Usage: -
    -- Updating the clicks key in the concept data for player 1
    -local custom_button =
    -Gui.get_concept('CustomButton')
    -
    -custom_button.update_data(1,function(tbl)
    -    tbl.clicks = tbl.clicks + 1 -- here we are incrementing the clicks by 1
    -end) -- player index 1
    -
    -
    -- Updating a value when a table is not used, alterative to get set
    --- so for this example assume that we did custom_button.set_data(1,0)
    -custom_button.update_data(1,function(value)
    -    return value + 1 -- here we are incrementing the value by 1, we may only be tracking clicks
    -end) -- player index 1
    -

    Concept Combined Instances

    +

    Test

    - # - Prototype:define_combined_store([category_callback], sync_callback) + # + expcore.gui
    -

    Used to add a both instance and data store which are linked together, new instances are synced to the current value, changing the stored value will change all instances

    -

    - Parameters: - -
      - - - - - -
    • - - category_callback - - : - - (function) - - when given will act as a way to turn an element into a string to act as a key; keys returned can over lap - - (optional) -
    • - - - - - -
    • - - sync_callback - - : - - (function) - - the function which is called to update an instance to match the store, this is called on all instances when concept.set_data or update_data is used - -
    • - - -
    - - Returns: -
      -
    • - (GuiConcept) - to allow chaining of functions -
    • -
    @@ -5639,59 +10869,21 @@ custom_button.update_data(1,fu - Usage: -
    -- Adding a check box which is a "global setting" synced between all players
    -local custom_button =
    -Gui.get_concept('checkbox'):clone('my_checkbox')
    -:set_caption('My Checkbox')
    -:set_tooltip('Clicking this check box will change it for everyone')
    -:on_state_changed(function(event)
    -    local element = event.element
    -    event.concept.set_data(element,element.state) -- Update the stored data to trigger an update of all other instances
    -end)
    -:define_combined_store(function(element,state) -- We could add a category function here if we wanted to
    -    element.state = state or false -- Note that the value passed may be nil if there is no stored value and no default set
    -end)
    - # - Prototype.sync_instance(element) + # + expcore.common
    -

    Will sync an instance to match the stored value based on the given sync callback

    -

    - Parameters: - -
      - - - - - -
    • - - element - - : - - (LuaGuiElement) - - the element that you want to have update - -
    • - - -
    - @@ -5702,73 +10894,71 @@ Gui.get_concept('checkbox'):clone(-- Setting the caption of this element to be the same as the stored value -local custom_button = -Gui.get_concept('CustomButton') - --- Used internally when first draw and automatically when the store updates -custom_button.sync_instance(element)
    -
    -

    Tests

    -
    - # - run_tests(player[, category]) + # + resources.color_presets +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + utils.event +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    +
    + # + expcore.store
    -

    Runs a set of gui tests to ensure that the system is working

    -

    - Parameters: - -
      - - - - - -
    • - - player - - : - - (LuaPlayer) - - the player that the guis are made for and who recives the results - -
    • - - - - - -
    • - - category - - : - - (string) - - when given only tests in this category are ran - - (optional) -
    • - - -
    - @@ -5779,9 +10969,6 @@ Gui.get_concept('CustomButton') - Usage: -
    -- Run all gui tests
    -Gui.run_tests(game.player)
    @@ -5800,7 +10987,7 @@ Gui.get_concept('CustomButton') generated by LDoc diff --git a/docs/core/Permissions-Groups.html b/docs/core/Permissions-Groups.html index 14d8fd23..cffa89f8 100644 --- a/docs/core/Permissions-Groups.html +++ b/docs/core/Permissions-Groups.html @@ -56,12 +56,10 @@ - - @@ -1434,7 +1432,7 @@ generated by LDoc diff --git a/docs/core/Roles.html b/docs/core/Roles.html index dbd23fa6..3187a4f7 100644 --- a/docs/core/Roles.html +++ b/docs/core/Roles.html @@ -60,12 +60,10 @@ - - @@ -3154,7 +3152,7 @@ generated by LDoc diff --git a/docs/core/Store.html b/docs/core/Store.html index 3b0822b1..97eda35f 100644 --- a/docs/core/Store.html +++ b/docs/core/Store.html @@ -53,12 +53,10 @@ - - @@ -1205,7 +1203,7 @@ this is similar to Store.get but will always return a table even if it is empty< generated by LDoc diff --git a/docs/core/Sudo.html b/docs/core/Sudo.html index 1e719894..53d24d08 100644 --- a/docs/core/Sudo.html +++ b/docs/core/Sudo.html @@ -53,12 +53,10 @@ - - @@ -546,7 +544,7 @@ generated by LDoc diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html index 5afefbbf..5d601cbe 100644 --- a/docs/guis/Player-List.html +++ b/docs/guis/Player-List.html @@ -65,12 +65,10 @@ - - @@ -628,7 +626,7 @@ generated by LDoc diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html index 8804e5c6..e3d10a38 100644 --- a/docs/guis/Rocket-Info.html +++ b/docs/guis/Rocket-Info.html @@ -65,12 +65,10 @@ - - @@ -631,7 +629,7 @@ generated by LDoc diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html index 3a06ef3e..59dc47ca 100644 --- a/docs/guis/Science-Info.html +++ b/docs/guis/Science-Info.html @@ -65,12 +65,10 @@ - - @@ -451,7 +449,7 @@ generated by LDoc diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html index 8178d793..a97b0a3e 100644 --- a/docs/guis/Task-List.html +++ b/docs/guis/Task-List.html @@ -65,12 +65,10 @@ - - @@ -634,7 +632,7 @@ generated by LDoc diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html index c267b5c2..75ae9c1d 100644 --- a/docs/guis/Warps-List.html +++ b/docs/guis/Warps-List.html @@ -65,12 +65,10 @@ - - @@ -839,7 +837,7 @@ generated by LDoc diff --git a/docs/index.html b/docs/index.html index e1859d62..6466ea5d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -56,11 +56,11 @@ Gui - Core Module - Gui - - - ExpStyle - Core Module - ExpStyle + Core Module - Gui + - This file is used to require all the different elements of the gui module + - each module has an outline here but for more details see their separate files in ./gui + - please read the files for more documentation that cant be shown here + - please note there is a rework planned but not started Permissions-Groups @@ -82,10 +82,6 @@ Core Module - Sudo - An extention of task and token to allow a single require to register and run functions bypassing all permissions. - - Toolbar - Core Module - Toolbar -

    Addons

    @@ -518,7 +514,7 @@ see ./expcore/commands.lua for more detailsgenerated by LDoc diff --git a/docs/modules/control.html b/docs/modules/control.html index 96f093f1..88f0ccce 100644 --- a/docs/modules/control.html +++ b/docs/modules/control.html @@ -72,12 +72,10 @@ - - @@ -353,7 +351,7 @@ generated by LDoc diff --git a/docs/modules/utils.alien_evolution_progress.html b/docs/modules/utils.alien_evolution_progress.html index d8b98af4..c377d74b 100644 --- a/docs/modules/utils.alien_evolution_progress.html +++ b/docs/modules/utils.alien_evolution_progress.html @@ -73,12 +73,10 @@ - - @@ -421,7 +419,7 @@ fraction will decide a chance to spawn. 1 alien for 2 spawner's will have 50% on generated by LDoc diff --git a/docs/modules/utils.core.html b/docs/modules/utils.core.html index 8d316e12..3378c6d3 100644 --- a/docs/modules/utils.core.html +++ b/docs/modules/utils.core.html @@ -74,12 +74,10 @@ - - @@ -1166,7 +1164,7 @@ generated by LDoc diff --git a/docs/modules/utils.debug.html b/docs/modules/utils.debug.html index 40c5610d..b00a200b 100644 --- a/docs/modules/utils.debug.html +++ b/docs/modules/utils.debug.html @@ -72,12 +72,10 @@ - - @@ -656,7 +654,7 @@ generated by LDoc diff --git a/docs/modules/utils.dump_env.html b/docs/modules/utils.dump_env.html index 02727b03..e4dc2c92 100644 --- a/docs/modules/utils.dump_env.html +++ b/docs/modules/utils.dump_env.html @@ -72,12 +72,10 @@ - - @@ -325,7 +323,7 @@ generated by LDoc diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html index dfa11db4..62b58139 100644 --- a/docs/modules/utils.event.html +++ b/docs/modules/utils.event.html @@ -73,12 +73,10 @@ - - @@ -1294,7 +1292,7 @@ generated by LDoc diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html index 38eff51c..64b7e446 100644 --- a/docs/modules/utils.event_core.html +++ b/docs/modules/utils.event_core.html @@ -72,12 +72,10 @@ - - @@ -436,7 +434,7 @@ generated by LDoc diff --git a/docs/modules/utils.math.html b/docs/modules/utils.math.html index da148586..56d4d37f 100644 --- a/docs/modules/utils.math.html +++ b/docs/modules/utils.math.html @@ -72,12 +72,10 @@ - - @@ -355,7 +353,7 @@ generated by LDoc diff --git a/docs/modules/utils.recipe_locker.html b/docs/modules/utils.recipe_locker.html index e422551c..3f85b13d 100644 --- a/docs/modules/utils.recipe_locker.html +++ b/docs/modules/utils.recipe_locker.html @@ -73,12 +73,10 @@ - - @@ -443,7 +441,7 @@ generated by LDoc diff --git a/docs/modules/utils.state_machine.html b/docs/modules/utils.state_machine.html index daa620a5..98f7bcd5 100644 --- a/docs/modules/utils.state_machine.html +++ b/docs/modules/utils.state_machine.html @@ -73,12 +73,10 @@ - - @@ -754,7 +752,7 @@ generated by LDoc diff --git a/docs/modules/utils.table.html b/docs/modules/utils.table.html index b90becff..3cbf7778 100644 --- a/docs/modules/utils.table.html +++ b/docs/modules/utils.table.html @@ -74,12 +74,10 @@ - - @@ -1420,7 +1418,7 @@ generated by LDoc diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html index db13570d..00472a97 100644 --- a/docs/modules/utils.task.html +++ b/docs/modules/utils.task.html @@ -73,12 +73,10 @@ - - @@ -653,7 +651,7 @@ generated by LDoc diff --git a/docs/modules/utils.timestamp.html b/docs/modules/utils.timestamp.html index ef9b3b28..99473b65 100644 --- a/docs/modules/utils.timestamp.html +++ b/docs/modules/utils.timestamp.html @@ -72,12 +72,10 @@ - - @@ -444,7 +442,7 @@ generated by LDoc diff --git a/docs/topics/license.html b/docs/topics/license.html index 2268d7de..e28db313 100644 --- a/docs/topics/license.html +++ b/docs/topics/license.html @@ -53,12 +53,10 @@ - - @@ -791,7 +789,7 @@ Public License instead of this License. But first, please read generated by LDoc diff --git a/docs/topics/readme.md.html b/docs/topics/readme.md.html index b5eed503..cc1c1178 100644 --- a/docs/topics/readme.md.html +++ b/docs/topics/readme.md.html @@ -53,12 +53,10 @@ - - @@ -335,7 +333,7 @@ generated by LDoc