Skip to content

net.rtml.RTMLContext

Peter edited this page Aug 21, 2024 · 1 revision

Part of net.rtml

Class: RTMLContext

RTML context builder

Constructor: _G.net.rtml.createContext()

Instantiate a new RTML context builder

Fields

Variable Description
elements: RTMLElement[] Context elements

Instance Functions

Signature Return Description
addElement(element) nil Add an RTMLElement to the context
addText(x, y, text, color?) nil Add a new text element
addLink(x, y, text, href) nil Add a new link element
addInput(x, y, length, name, hide?) nil Add a new input element
addButton(x, y, text, action) nil Add a new button element
addSubmitButton(x, y, text) nil Add a new submit button element

Detail

Functions

addElement

RTMLContext:addElement(type: string, x: number, y: number): nil

Add an RTMLElement to the context

Parameters

  • type: string - Element type (one of net.rtml.TYPE_*)
  • x: number - X position of the element
  • y: number - Y position of the element

addText

RTMLContext:addText(x: number, y: number, text: string, color: nil|color|string): nil

Add a new text element

Parameters

  • x: number - X position of the element
  • y: number - Y position of the element
  • text: string - Element text
  • color: nil|color|string - (Optional) Text color

addLink

RTMLContext:addLink(x: number, y: number, text: string, href: string): nil

Add a new link element

Parameters

  • x: number - X position of the element
  • y: number - Y position of the element
  • text: string - Link text
  • href: string - Link destination, can be absolute ("/path"), or relative ("path")

addInput

RTMLContext:addInput(x: number, y: number, length: number, name: string, hide: boolean?): nil

Add a new input element

Parameters

  • x: number - X position of the element
  • y: number - Y position of the element
  • length: number - Input length
  • name: string - Input name for forms
  • hide: boolean? - (Optional) If input text should be hidden

addButton

RTMLContext:addButton(x: number, y: number, text: string, action: "SUBMIT"|"PUSH"): nil

Add a new button element

Parameters

  • x: number - X position of the element
  • y: number - Y position of the element
  • text: string - Button text
  • action: "SUBMIT"|"PUSH" - Button action (one of net.rtml.BUTTON_ACTION_*)

addSubmitButton

RTMLContext:addSubmitButton(x: number, y: number, text: string, action: "SUBMIT"|"PUSH"): nil

Add a new submit button element. Equivalent to setting action to "SUBMIT" for addButton()

Parameters

  • x: number - X position of the element
  • y: number - Y position of the element
  • text: string - Button text