Skip to content

net.rtml

Peter edited this page Aug 23, 2024 · 2 revisions
_g.net.rtml

Important

The net.rtml module must be loaded with pos.require('net.rtml') before it can be used from the global table

Unlike normal libraries it IS injected into the global table and a local reference is not required

Overview

Functions

Signature Return Description
createElement(type, x, y) RTMLElement Create a new typed RTMLElement
createText(x, y, text, color?) RTMLElement Create a new text element
createLink(x, y, text, href) RTMLElement Create a new link element
createInput(x, y, length, name, hide?) RTMLElement Create a new input element
createButton(x, y, tex, action) RTMLElement Create a new button element
createSubmitButton(x, y, text) RTMLElement Create a new submit button element
createContext() RTMLContext Create a new RTML context

Variables

Variable Value Description
TYPE_TEXT: string "TEXT" Element type code for a text element
TYPE_INPUT: string "INPUT" Element type code for a text input element
TYPE_LINK: string "LINK" Element type code for a link element
TYPE_DOMAIN_LINK: string "DOM-LINK" Element type code for a domain link element
TYPE_BUTTON: string "BUTTON" Element type code for a button element
BUTTON_ACTION_SUBMIT: "SUBMIT" Button action code for form submission
BUTTON_ACTION_PUSH: "PUSH" Button action code for button ID push

Classes

RTMLElement

RTMLContext

Detail

Functions

createElement

net.rtml.createElement(type: string, x: number, y: number): RTMLElement

Create a new typed RTMLElement

Parameters

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

Returns

  • element: RTMLElement - The created element

createText

net.rtml.createText(x: number, y: number, text: string, color: nil|color|string): RTMLElement

Create 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

Returns

  • element: RTMLElement - The created element

createLink

net.rtml.createLink(x: number, y: number, text: string, href: string): RTMLElement

Create 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")

Returns

  • element: RTMLElement - The created element

createInput

net.rtml.createInput(x: number, y: number, length: number, name: string, hide: boolean?): RTMLElement

Create 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

Returns

  • element: RTMLElement - The created element

createButton

net.rtml.createButton(x: number, y: number, text: string, action: "SUBMIT"|"PUSH"): RTMLElement

Create 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_*)

Returns

  • element: RTMLElement - The created element

createSubmitButton

net.rtml.createSubmitButton(x: number, y: number, text: string, action: "SUBMIT"|"PUSH"): RTMLElement

Create a new submit button element. Equivalent to setting action to "SUBMIT" for createButton()

Parameters

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

Returns

  • element: RTMLElement - The created element

createContext

net.rtml.createContext(): RTMLContext

Create a new RTML context (somewhat equivalent to a window) for simple construction of RTML.

Returns

  • context: RTMLContext - The created context

Classes

RTMLElement

RTML element

Field Description
type: string Element type
x: number X position of the element
y: number Y position of the element
color: nil|color|string Element foreground color
bgColor: nil|color|string Element background color
id: string? Element ID
text: string? Element text
name: string? (Form Element Only) Element name
href: string? (Link Element Only) Link url
len: number? (Input Only) Length of element
hide: boolean? (Input Only) If input text should be hidden
next: string? (Input Only) Next input to focus by form element name
action: nil|"SUBMIT"|"PUSH" (Button Only) Button action