Skip to content

net.rtml.rtmlLoader

Peter edited this page Aug 23, 2024 · 2 revisions
local rtmlLoader = pos.require('net.rtml.rtmlLoader')

Important

This is a loaded library and must loaded and referenced using 'net.rtml.rtmlLoader'

It is NOT injected into the global table

Overview

Functions

Signature Return Description
loadFile(filename) table? Load an RTML file by filename
load(file) table? Load RTML from plaintext LUA object or XML
parseTag(line) string?, {string: any}?, boolean?, string? Get XML tag name and attributes

Detail

Functions

loadFile

rtmlLoader.loadFile(filename: string): table?

Load an RTML file by filename

Parameters

  • filename: string - Path to file to load and parse

Returns

  • rtml: table? - RTML as Lua object OR nil if it could not be parsed

load

rtmlLoader.load(file: string): table?

Load RTML from plaintext LUA object or XML

Parameters

  • file: string - File as string to parse

Returns

  • rtml: table? - RTML as Lua object OR nil if it could not be parsed

parseTag

rtmlLoader.parseTag(line: string): string?, {string: any}?, boolean?, string?

Get XML tag name and attributes. Returns nil if no tag could be found

Parameters

  • line: string - Line to parse for XML tag

Returns

  • name: string? - Name of the tag
  • attributes: {string: any}? - Attribute table of tag (will be nil if tag is closing tag)
  • closingTag: boolean? - If the tag is self closing or a closing tag
  • line: string? - Remaining portion of line after XML tag

Clone this wiki locally