Basic Classes - JanSharp/JanSharpsGuiLibrary GitHub Wiki
The Basic Classes are GuiClass
es for every type of LuaGuiElement
.
Every class has the following:
- class_name: the exact same name as the
LuaGuiElement
's type - create function
- Event Handlers
create function
Takes 2 parameters:
- data
- passed_data
- both can be
nil
- if data is nil, it will be set to an empty table (
{}
) data.type
will be set to the respective type (class_name
)return data, passed_data
Event Handlers
Every class has event handlers registered for every event relevant to it's type (see basic-class-event-map.lua
). Upon creation of a GuiClassInst
it will look for a function on the passed_parent
with the name event_name .. "_" .. (inst.name_for_events or inst.name)
and will only subscribe an event handler if that function exists (using event_condition
s).
Then, once an event fires, the respective function on the passed_parent
will be called with the following arguments:
passed_parent
: thepassed_parent
itselfself
/inst
: the inst of the basic classevent
: the data received from the api