The Battle for Wesnoth  1.19.5+dev
Functions
lua_wml Namespace Reference

Functions

static int intf_wml_tostring (lua_State *L)
 Dumps a wml table or userdata wml object into a pretty string. More...
 
static int intf_load_wml (lua_State *L)
 Loads a WML file into a config. More...
 
static int intf_parse_wml (lua_State *L)
 Parses a WML string into a config; does not preprocess or validate. More...
 
static int intf_clone_wml (lua_State *L)
 Returns a clone (deep copy) of the passed config, which can be either a normal config or a vconfig If it is a vconfig, the underlying config is also cloned. More...
 
static int intf_wml_interpolate (lua_State *L)
 Interpolates variables into a WML table, including [insert_tag] Arg 1: WML table to interpolate into Arg 2: WML table of variables. More...
 
static int intf_wml_matches_filter (lua_State *L)
 Tests if a WML table matches a filter Arg 1: table to test Arg 2: filter. More...
 
static int intf_wml_merge (lua_State *L)
 Merges two WML tables Arg 1: base table Arg 2: table to merge in. More...
 
static int intf_wml_diff (lua_State *L)
 Computes a diff of two WML tables Arg 1: left table Arg 2: right table. More...
 
static int intf_wml_patch (lua_State *L)
 Applies a diff to a WML table Arg 1: base table Arg 2: WML diff. More...
 
static int intf_wml_equal (lua_State *L)
 Tests if two WML tables are equal (have the same keys and values, same tags, recursively) Arg 1: left table Arg 2: right table. More...
 
static int intf_wml_valid (lua_State *L)
 Tests if a table represents a valid WML table Arg 1: table. More...
 
int luaW_open (lua_State *L)
 

Function Documentation

◆ intf_clone_wml()

static int lua_wml::intf_clone_wml ( lua_State *  L)
static

Returns a clone (deep copy) of the passed config, which can be either a normal config or a vconfig If it is a vconfig, the underlying config is also cloned.

  • Arg 1: a config
  • Ret: the cloned config

Definition at line 121 of file lua_wml.cpp.

References vconfig::get_config(), luaW_checkconfig(), luaW_pushconfig(), and luaW_pushvconfig().

Referenced by luaW_open().

◆ intf_load_wml()

static int lua_wml::intf_load_wml ( lua_State *  L)
static

Loads a WML file into a config.

  • Arg 1: WML file path
  • Arg 2: (optional) Array of preprocessor defines, or false to skip preprocessing (true is also valid)
  • Arg 3: (optional) Path to a schema file for validation (omit for no validation)
  • Ret: config

Definition at line 51 of file lua_wml.cpp.

References filesystem::get_wml_location(), i, luaW_pushconfig(), luaW_toboolean(), n, preprocess_file(), read(), and validator.

Referenced by luaW_open().

◆ intf_parse_wml()

static int lua_wml::intf_parse_wml ( lua_State *  L)
static

Parses a WML string into a config; does not preprocess or validate.

  • Arg 1: WML string
  • Ret: config

Definition at line 100 of file lua_wml.cpp.

References filesystem::get_wml_location(), luaW_pushconfig(), read(), and validator.

Referenced by luaW_open().

◆ intf_wml_diff()

static int lua_wml::intf_wml_diff ( lua_State *  L)
static

Computes a diff of two WML tables Arg 1: left table Arg 2: right table.

Definition at line 194 of file lua_wml.cpp.

References config::get_diff(), luaW_checkconfig(), and luaW_pushconfig().

Referenced by luaW_open().

◆ intf_wml_equal()

static int lua_wml::intf_wml_equal ( lua_State *  L)
static

Tests if two WML tables are equal (have the same keys and values, same tags, recursively) Arg 1: left table Arg 2: right table.

Definition at line 221 of file lua_wml.cpp.

References luaW_checkconfig().

Referenced by luaW_open().

◆ intf_wml_interpolate()

static int lua_wml::intf_wml_interpolate ( lua_State *  L)
static

Interpolates variables into a WML table, including [insert_tag] Arg 1: WML table to interpolate into Arg 2: WML table of variables.

Definition at line 140 of file lua_wml.cpp.

References vconfig::get_parsed_config(), luaW_checkconfig(), and luaW_pushconfig().

Referenced by luaW_open().

◆ intf_wml_matches_filter()

static int lua_wml::intf_wml_matches_filter ( lua_State *  L)
static

Tests if a WML table matches a filter Arg 1: table to test Arg 2: filter.

Definition at line 154 of file lua_wml.cpp.

References luaW_checkconfig(), and config::matches().

Referenced by luaW_open().

◆ intf_wml_merge()

static int lua_wml::intf_wml_merge ( lua_State *  L)
static

Merges two WML tables Arg 1: base table Arg 2: table to merge in.

Definition at line 167 of file lua_wml.cpp.

References _(), config::all_children_view(), config::append_children(), config::clear_children(), luaW_checkconfig(), luaW_pushconfig(), config::merge_attributes(), and config::merge_with().

Referenced by luaW_open().

◆ intf_wml_patch()

static int lua_wml::intf_wml_patch ( lua_State *  L)
static

Applies a diff to a WML table Arg 1: base table Arg 2: WML diff.

Definition at line 207 of file lua_wml.cpp.

References config::apply_diff(), luaW_checkconfig(), and luaW_pushconfig().

Referenced by luaW_open().

◆ intf_wml_tostring()

static int lua_wml::intf_wml_tostring ( lua_State *  L)
static

Dumps a wml table or userdata wml object into a pretty string.

  • Arg 1: wml table or vconfig userdata
  • Ret 1: string

Definition at line 36 of file lua_wml.cpp.

References luaW_checkconfig(), and write().

Referenced by luaW_open().

◆ intf_wml_valid()

static int lua_wml::intf_wml_valid ( lua_State *  L)
static

Tests if a table represents a valid WML table Arg 1: table.

Definition at line 233 of file lua_wml.cpp.

References luaW_toconfig(), and config::validate_wml().

Referenced by luaW_open().

◆ luaW_open()

int lua_wml::luaW_open ( lua_State *  L)