From 6c39335b80fb85fc7b2c909e8ce9d3f2103397e9 Mon Sep 17 00:00:00 2001
From: Cooldude2606
-- Making the base button concept
+local button =
+Gui.new_concept('Button')
+:new_event('on_click',defines.events.on_gui_click)
+: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)
+ -- Makeing a alternative button based on the first
+local custom_button =
+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)
+:set_caption('Custom Button')
+:set_tooltip('Only admins can press this button')
+:on_click(function(event)
+ if not event.player.admin then
+ event.player.print('You must be admin to use this button')
+ end
+end)
+:on_admin_clicked(function(event)
+ -- Yes i know this can just be an if else but its an example
+ game.print(event.player.name..' pressed my admin button')
+end)
+ -- Drawing a concept
+custom_button:draw(game.player.gui.left)
@@ -404,8 +439,8 @@
Usage:
-
-local custom_button =
+ -- Clones the base Button concept to make a alternative button
+local custom_button =
Gui.get_concept('Button'):clone('CustomButton')
@@ -499,8 +534,8 @@ Gui.get_concept('Button'):clone(
Usage:
-
-local custom_button =
+ -- 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
@@ -563,9 +598,9 @@ Gui.get_concept('Button'):clone(
Usage:
-
-local custom_button =
-Gui.get_concept('CustomButton'):clone('MyCustomButton')
+ -- 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)
@@ -654,8 +689,8 @@ Gui.get_concept('CustomButton'):clone(
-local custom_button =
+ -- 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
@@ -754,8 +789,8 @@ Gui.get_concept('CustomButton')
Usage:
-
-local button =
+ -- 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)
@@ -826,12 +861,11 @@ Gui.get_concept('Button')
Usage:
-
-local custom_button =
+ -- 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
+ -- 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')
@@ -894,8 +928,8 @@ Gui.get_concept('CustomButton')
Usage:
-
-local button =
+ -- 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)
-- Note that element might be nil if this is the first draw function
@@ -981,8 +1015,8 @@ Gui.get_concept('Button')
Usage:
-
-local custom_button =
+ -- 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
@@ -1049,8 +1083,8 @@ Gui.get_concept('CustomButton')
Usage:
-
--- Note even thou this is a copy of Button; if Button had an instance store it would not be cloned over
+ -- 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)
@@ -1115,8 +1149,8 @@ Gui.get_concept('CustomButton')
Usage:
-
-local custom_button =
+ -- 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
@@ -1188,8 +1222,8 @@ custom_button.get_instances(1) -- player index
Usage:
-
-local custom_button =
+ -- 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
@@ -1261,12 +1295,11 @@ custom_button.add_instance(element) -- normally not
Usage:
-
-local custom_button =
+ -- Changing the font color of all instances for player 1
+local custom_button =
Gui.get_concept('CustomButton')
--- Change all the instances to have red text for player 1
-custom_button.update_instances(1,function(element)
+custom_button.update_instances(1,function(element)
element.style.font_color = {r=1,g=0,b=0}
end)
@@ -1331,8 +1364,8 @@ Gui.get_concept('CustomButton')
Usage:
-
--- Note even thou this is a copy of Button; if Button had an data store it would not be cloned over
+ -- 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)
@@ -1397,8 +1430,8 @@ Gui.get_concept('CustomButton')
Usage:
-
-local custom_button =
+ -- Getting the stored data for player 1
+local custom_button =
Gui.get_concept('CustomButton')
custom_button.get_data(1) -- player index 1
@@ -1470,8 +1503,8 @@ custom_button.get_data(1) -- player index
Usage:
-
-local custom_button =
+ -- 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
@@ -1532,8 +1565,8 @@ Gui.get_concept('CustomButton')
Usage:
-
-local custom_button =
+ -- Clearing the data for player 1
+local custom_button =
Gui.get_concept('CustomButton')
custom_button.clear_data(1) -- player index 1
@@ -1605,16 +1638,15 @@ custom_button.clear_data(1) -- player index
Usage:
-
-local custom_button =
+ -- 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
-
--- Alterative method more useful when not using a table
+ -- 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
@@ -1710,8 +1742,8 @@ custom_button.update_data(1,fu
Usage:
-
-local custom_button =
+ -- Adding a way to sync captions bettween all instances, more useful for things that arnt buttons
+local custom_button =
Gui.get_concept('CustomButton')
:define_combined_store(
function(element)
@@ -1774,8 +1806,8 @@ Gui.get_concept('CustomButton')
Usage:
-
-local custom_button =
+ -- 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
@@ -1831,8 +1863,8 @@ Gui.get_concept('CustomButton')
Usage:
-
-local custom_button =
+ -- Setting the stored value to be the same as the caption for this element
+local custom_button =
Gui.get_concept('CustomButton')
-- You may want to use this with gui events
@@ -1855,7 +1887,7 @@ Gui.get_concept('CustomButton')
generated by LDoc
diff --git a/docs/core/Permissions-Groups.html b/docs/core/Permissions-Groups.html
index 3a4c5455..4befca44 100644
--- a/docs/core/Permissions-Groups.html
+++ b/docs/core/Permissions-Groups.html
@@ -1432,7 +1432,7 @@
generated by LDoc
diff --git a/docs/core/Roles.html b/docs/core/Roles.html
index 3354671f..a2bef34f 100644
--- a/docs/core/Roles.html
+++ b/docs/core/Roles.html
@@ -3152,7 +3152,7 @@
generated by LDoc
diff --git a/docs/core/Store.html b/docs/core/Store.html
index 56ffe579..6026f246 100644
--- a/docs/core/Store.html
+++ b/docs/core/Store.html
@@ -1128,7 +1128,7 @@ Store.register(team_scores,function(value,key)
generated by LDoc
diff --git a/docs/core/Sudo.html b/docs/core/Sudo.html
index 75ba5a96..b037fbf6 100644
--- a/docs/core/Sudo.html
+++ b/docs/core/Sudo.html
@@ -544,7 +544,7 @@
generated by LDoc
diff --git a/docs/guis/Player-List.html b/docs/guis/Player-List.html
index 5f4b98d8..8aa3ef94 100644
--- a/docs/guis/Player-List.html
+++ b/docs/guis/Player-List.html
@@ -626,7 +626,7 @@
generated by LDoc
diff --git a/docs/guis/Rocket-Info.html b/docs/guis/Rocket-Info.html
index 4419add4..49db82bf 100644
--- a/docs/guis/Rocket-Info.html
+++ b/docs/guis/Rocket-Info.html
@@ -629,7 +629,7 @@
generated by LDoc
diff --git a/docs/guis/Science-Info.html b/docs/guis/Science-Info.html
index bb73a355..1d910135 100644
--- a/docs/guis/Science-Info.html
+++ b/docs/guis/Science-Info.html
@@ -449,7 +449,7 @@
generated by LDoc
diff --git a/docs/guis/Task-List.html b/docs/guis/Task-List.html
index 076de4f3..8b3221fb 100644
--- a/docs/guis/Task-List.html
+++ b/docs/guis/Task-List.html
@@ -632,7 +632,7 @@
generated by LDoc
diff --git a/docs/guis/Warps-List.html b/docs/guis/Warps-List.html
index ba48ab73..0a12a90f 100644
--- a/docs/guis/Warps-List.html
+++ b/docs/guis/Warps-List.html
@@ -837,7 +837,7 @@
generated by LDoc
diff --git a/docs/index.html b/docs/index.html
index 2c08495e..bd8cb83a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -510,7 +510,7 @@ see ./expcore/commands.lua for more details
generated by LDoc
diff --git a/docs/modules/control.html b/docs/modules/control.html
index 5fa17272..c79d10b4 100644
--- a/docs/modules/control.html
+++ b/docs/modules/control.html
@@ -351,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 fea3e318..a8dd8517 100644
--- a/docs/modules/utils.alien_evolution_progress.html
+++ b/docs/modules/utils.alien_evolution_progress.html
@@ -419,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 3ca21622..d3329c77 100644
--- a/docs/modules/utils.core.html
+++ b/docs/modules/utils.core.html
@@ -1164,7 +1164,7 @@
generated by LDoc
diff --git a/docs/modules/utils.debug.html b/docs/modules/utils.debug.html
index 5d26a71d..5e50472a 100644
--- a/docs/modules/utils.debug.html
+++ b/docs/modules/utils.debug.html
@@ -654,7 +654,7 @@
generated by LDoc
diff --git a/docs/modules/utils.dump_env.html b/docs/modules/utils.dump_env.html
index 772f991a..ef683374 100644
--- a/docs/modules/utils.dump_env.html
+++ b/docs/modules/utils.dump_env.html
@@ -323,7 +323,7 @@
generated by LDoc
diff --git a/docs/modules/utils.event.html b/docs/modules/utils.event.html
index 2db04168..9f27e495 100644
--- a/docs/modules/utils.event.html
+++ b/docs/modules/utils.event.html
@@ -1292,7 +1292,7 @@
generated by LDoc
diff --git a/docs/modules/utils.event_core.html b/docs/modules/utils.event_core.html
index a9251bb1..d369a623 100644
--- a/docs/modules/utils.event_core.html
+++ b/docs/modules/utils.event_core.html
@@ -434,7 +434,7 @@
generated by LDoc
diff --git a/docs/modules/utils.math.html b/docs/modules/utils.math.html
index 219edb14..78cd66e7 100644
--- a/docs/modules/utils.math.html
+++ b/docs/modules/utils.math.html
@@ -338,7 +338,7 @@
generated by LDoc
diff --git a/docs/modules/utils.recipe_locker.html b/docs/modules/utils.recipe_locker.html
index 08b3b0dc..dc87e650 100644
--- a/docs/modules/utils.recipe_locker.html
+++ b/docs/modules/utils.recipe_locker.html
@@ -441,7 +441,7 @@
generated by LDoc
diff --git a/docs/modules/utils.state_machine.html b/docs/modules/utils.state_machine.html
index d609ecb6..394ccfb3 100644
--- a/docs/modules/utils.state_machine.html
+++ b/docs/modules/utils.state_machine.html
@@ -752,7 +752,7 @@
generated by LDoc
diff --git a/docs/modules/utils.table.html b/docs/modules/utils.table.html
index f3b85d5b..406abc06 100644
--- a/docs/modules/utils.table.html
+++ b/docs/modules/utils.table.html
@@ -1382,7 +1382,7 @@
generated by LDoc
diff --git a/docs/modules/utils.task.html b/docs/modules/utils.task.html
index 5284f6e4..e70b97ec 100644
--- a/docs/modules/utils.task.html
+++ b/docs/modules/utils.task.html
@@ -651,7 +651,7 @@
generated by LDoc
diff --git a/docs/modules/utils.timestamp.html b/docs/modules/utils.timestamp.html
index 10e8d500..54faeee6 100644
--- a/docs/modules/utils.timestamp.html
+++ b/docs/modules/utils.timestamp.html
@@ -442,7 +442,7 @@
generated by LDoc
diff --git a/docs/topics/license.html b/docs/topics/license.html
index 66afe33d..79b030c8 100644
--- a/docs/topics/license.html
+++ b/docs/topics/license.html
@@ -789,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 58c0a663..419754b9 100644
--- a/docs/topics/readme.md.html
+++ b/docs/topics/readme.md.html
@@ -332,7 +332,7 @@
generated by LDoc
diff --git a/expcore/gui.lua b/expcore/gui.lua
index 351eafdc..3dbe55df 100644
--- a/expcore/gui.lua
+++ b/expcore/gui.lua
@@ -1,6 +1,43 @@
--[[-- Core Module - Gui
@core Gui
@alias Gui
+
+@usage-- Making the base button concept
+local button =
+Gui.new_concept('Button')
+:new_event('on_click',defines.events.on_gui_click)
+: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)
+
+@usage-- Makeing a alternative button based on the first
+local custom_button =
+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)
+:set_caption('Custom Button')
+:set_tooltip('Only admins can press this button')
+:on_click(function(event)
+ if not event.player.admin then
+ event.player.print('You must be admin to use this button')
+ end
+end)
+:on_admin_clicked(function(event)
+ -- Yes i know this can just be an if else but its an example
+ game.print(event.player.name..' pressed my admin button')
+end)
+
+@usage-- Drawing a concept
+custom_button:draw(game.player.gui.left)
]]
local Gui = require 'expcore.gui.core'
diff --git a/expcore/gui/prototype.lua b/expcore/gui/prototype.lua
index cc84c5eb..4c92dfa5 100644
--- a/expcore/gui/prototype.lua
+++ b/expcore/gui/prototype.lua
@@ -2,7 +2,8 @@
@module Gui
@alias Prototype
- @usage
+@usage DX note - chaning this doc string has no effect on the docs
+
local button =
Gui.new_concept('Button')
:new_event('on_click',defines.events.on_gui_click)
@@ -74,7 +75,7 @@ end
--[[-- Used to copy all the settings from one concept to another and removing links to the orginal
@tparam string concept_name the name of the new concept; must be unique
@treturn GuiConcept the base for building a custom gui
-@usage
+@usage-- Clones the base Button concept to make a alternative button
local custom_button =
Gui.get_concept('Button'):clone('CustomButton')
]]
@@ -124,7 +125,7 @@ end
@tparam[opt] defines.events factorio_event when given will fire the custom event when the factorio event is raised
@tparam[opt] function event_condition 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
@treturn GuiConcept to allow chaing of functions
-@usage
+@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)
@@ -141,9 +142,9 @@ function Prototype:new_event(event_name,factorio_event,event_condition)
@function Prototype:on_custom_event
@tparam function handler the function which will recive the event
@treturn GuiConcept to allow chaing of functions
-@usage
+@usage-- When an admin clicks the button a message is printed
local custom_button =
-Gui.get_concept('CustomButton'):clone('MyCustomButton')
+Gui.get_concept('CustomButton')
:on_admin_clicked(function(event)
game.print(event.player.name..' pressed my admin button')
end)
@@ -179,7 +180,7 @@ end
@tparam string event_name the name of the event that you want to raise
@tparam[opt={}] table event table containg data you want to send with the event, some keys already included
@tparam[opt=false] boolean from_factorio internal use, if the raise came from the factorio event handler
-@usage
+@usage-- Raising the custom event on_admin_clicked
local custom_button =
Gui.get_concept('CustomButton')
@@ -225,7 +226,7 @@ end
@tparam any default the default value for this property, although not strictly required is is strongly recomented
@tparam[opt] function setter_callback this function is called when set is called, if not provided then key in concept.properties is updated to new value
@treturn GuiConcept to allow chaing of functions
-@usage
+@usage-- Adding caption, sprite, and tooltip to the base button concept
local button =
Gui.get_concept('Button')
:new_property('tooltip')
@@ -253,13 +254,12 @@ function Prototype:new_property(property_name,default,setter_callback)
@function Prototype:set_custom_property
@tparam any value the value that you want to set for this property
@treturn GuiConcept to allow chaing of functions
-@usage
+@usage-- Setting the caption on the base button concept after a cloning
local custom_button =
Gui.get_concept('Button')
:set_caption('Default Button')
-@usage
--- In our examples CustomButton is cloned from Button, this means the caption property already exists
+@usage-- 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')
@@ -287,7 +287,7 @@ end
--[[-- Used to define how the concept is turned into an ingame element or "instance" as we may refer to them
@tparam function draw_callback the function that will be called to draw/update the instance; this function must return the instance or the new acting instance
@treturn GuiConcept to allow chaing of functions
-@usage
+@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)
@@ -332,7 +332,7 @@ end
--[[-- Calls all the draw functions in order to create this concept in game; will also store and sync the instance if stores are used
@tparam LuaGuiElement parent_element the element that the concept will use as a base
@treturn LuaGuiElement the element that was created and then passed though and returned by the draw functions
-@usage
+@usage-- Drawing the custom button concept
local custom_button =
Gui.get_concept('CustomButton')
@@ -372,7 +372,7 @@ end
--[[-- Adds an instance store to the concept; when a new instance is made it is stored so you can access it later
@tparam[opt] function category_callback when given will act as a way to turn an element into a string to act as a key; keys returned can over lap
@treturn GuiConcept to allow chaing of functions
-@usage
+@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')
@@ -392,7 +392,7 @@ function Prototype:define_instance_store(category_callback)
@function Prototype.get_instances
@tparam[opt] ?string|LuaGuiElement category the category to get, can only be nil if categories are not used
@treturn table a table which contains all the instances
-@usage
+@usage-- Getting all the instances of the player with index 1
local custom_button =
Gui.get_concept('CustomButton')
@@ -406,7 +406,7 @@ custom_button.get_instances(1) -- player index 1
@function Prototype.add_instance
@tparam LuaGuiElement element the element that will be added as an instance
@tparam[opt] string category the category to add this element under, if nil the category callback is used to assign one
-@usage
+@usage-- Adding an element as a instance for this concept, mostly for internal use
local custom_button =
Gui.get_concept('CustomButton')
@@ -428,11 +428,10 @@ custom_button.add_instance(element) -- normally not needed due to use in concept
@function Prototype.update_instances
@tparam[opt] ?string|LuaGuiElement category the category to get, can only be nil if categories are not used
@tparam function update_callback the function which is called on each instance, recives other args passed to update_instances
-@usage
+@usage-- Changing the font color of all instances for player 1
local custom_button =
Gui.get_concept('CustomButton')
--- Change all the instances to have red text for player 1
custom_button.update_instances(1,function(element)
element.style.font_color = {r=1,g=0,b=0}
end)
@@ -465,7 +464,7 @@ end
--[[-- Adds a data store to this concept which allows you to store synced/percistent data between instances
@tparam[opt] function category_callback when given will act as a way to turn an element into a string to act as a key; keys returned can over lap
@treturn GuiConcept to allow chaing of functions
-@usage
+@usage-- 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')
@@ -491,7 +490,7 @@ function Prototype:define_data_store(category_callback)
@function Prototype.get_data
@tparam[opt] ?string|LuaGuiElement category the category to get, can only be nil if categories are not used
@treturn any the data that you had stored in this location
-@usage
+@usage-- Getting the stored data for player 1
local custom_button =
Gui.get_concept('CustomButton')
@@ -505,7 +504,7 @@ custom_button.get_data(1) -- player index 1
@function Prototype.set_data
@tparam[opt] ?string|LuaGuiElement category the category to set, can only be nil if categories are not used
@tparam any value the data that you want to stored in this location
-@usage
+@usage-- Setting the data for player 1 to a table with two keys
local custom_button =
Gui.get_concept('CustomButton')
@@ -523,7 +522,7 @@ custom_button.set_data(1,{
--[[-- Clears the data that is stored for this category
@function Prototype.clear_data
@tparam[opt] ?string|LuaGuiElement category the category to clear, can only be nil if categories are not used
-@usage
+@usage-- Clearing the data for player 1
local custom_button =
Gui.get_concept('CustomButton')
@@ -537,7 +536,7 @@ custom_button.clear_data(1) -- player index 1
@function Prototype.update_data
@tparam[opt] ?string|LuaGuiElement category the category to clear, can only be nil if categories are not used
@tparam function update_callback the function which is called to update the data
-@usage
+@usage-- Updating the clicks key in the concept data for player 1
local custom_button =
Gui.get_concept('CustomButton')
@@ -545,8 +544,7 @@ custom_button.update_data(1,function(tbl)
tbl.clicks = tbl.clicks + 1 -- here we are incrementing the clicks by 1
end) -- player index 1
-@usage
--- Alterative method more useful when not using a table
+@usage-- 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
@@ -564,7 +562,7 @@ end
@tparam function get_callback the function which is called when you set the store from an instance
@tparam function set_callback the function which is called when you update an instance using the value in the store
@treturn GuiConcept to allow chaing of functions
-@usage
+@usage-- Adding a way to sync captions bettween all instances, more useful for things that arnt buttons
local custom_button =
Gui.get_concept('CustomButton')
:define_combined_store(
@@ -596,7 +594,7 @@ function Prototype:define_combined_store(category_callback,get_callback,set_call
--[[-- Will set the state of an instance based on the value in the store
@function Prototype.set_instance_from_store
@tparam LuaGuiElement the element that you want to have update
-@usage
+@usage-- Setting the caption of this element to be the same as the stored value
local custom_button =
Gui.get_concept('CustomButton')
@@ -610,7 +608,7 @@ custom_button.set_instance_from_store(element)
--[[-- Will set the value in the store and update the other instances based on the instance given
@function Prototype.set_store_from_instance
@tparam LuaGuiElement the element that you want to use to update the store
-@usage
+@usage-- Setting the stored value to be the same as the caption for this element
local custom_button =
Gui.get_concept('CustomButton')