Basic Classes - JanSharp/JanSharpsGuiLibrary GitHub Wiki

The Basic Classes are GuiClasses for every type of LuaGuiElement.

Every class has the following:

create function

Takes 2 parameters:

  1. data
  2. 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_conditions).

Then, once an event fires, the respective function on the passed_parent will be called with the following arguments:

  1. passed_parent: the passed_parent itself
  2. self/inst: the inst of the basic class
  3. event: the data received from the api