Skip to content
This repository was archived by the owner on Aug 20, 2022. It is now read-only.
benank edited this page Aug 19, 2020 · 4 revisions

UI

  • Singleton class for UI management

UI:Create(args)

  • Creates a new UIInstance and creates a new HTML window.
  • args (in table):
    • name (string): name of the UI instance you want to create. Must be unique.
    • path (string): path to the HTML page to load. Must be relative to resource, eg lobby/client/html/index.html (where your resource name is gamemode, or anything else. lobby is a module within your resource.)
  • returns: UIInstance of the instance you just created

UI:GetSize()

  • Gets the screen size in pixels.
  • returns: table containing x and y values of the screen size.

UI:SetCursor(enabled)

  • Shows/hides the cursor for all UI. Also sets UI focus so keypresses will no longer register in the game.
  • Ref counted, so every time you call it with true, you must call it with false to hide the cursor.
  • enabled (bool): whether or not the mouse should be enabled

UI:GetCursor()

  • Returns the ref count for the cursor.
  • returns: number containing ref count

UI:CallEvent(args)

  • Calls an event on a single or all UI instances.
  • args (in table)
    • data (table): the table of data you want to send
    • event_name (string): event name to call
    • name (optional, string): name of the UI instance you want to send to, nil to call event on all instances

UI:Remove(name)

  • Removes a UI instance by name.
  • name (string): name of the UI instance to remove
Clone this wiki locally