The Battle for Wesnoth  1.15.2+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 122 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 52 of file lua_wml.cpp.

References config::get(), filesystem::get_wml_location(), i, lua_geti(), lua_isnoneornil, lua_isstring(), lua_len(), lua_pop, LUA_TBOOLEAN, lua_tonumber, lua_tostring, LUA_TTABLE, LUA_TUSERDATA, lua_type(), luaL_argerror(), luaL_checkstring, luaL_optstring, luaW_pushconfig(), luaW_toboolean(), n, preprocess_file(), and read().

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 101 of file lua_wml.cpp.

References config::get(), filesystem::get_wml_location(), luaL_checkstring, luaL_optstring, luaW_pushconfig(), and read().

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 195 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 222 of file lua_wml.cpp.

References left, lua_pushboolean(), luaW_checkconfig(), and right.

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 141 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 155 of file lua_wml.cpp.

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

Referenced by luaW_open().

◆ intf_wml_merge()

static int lua_wml::intf_wml_merge ( lua_State L)
static

◆ 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 208 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 37 of file lua_wml.cpp.

References lua_pushstring(), 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 234 of file lua_wml.cpp.

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

Referenced by luaW_open().

◆ luaW_open()

int lua_wml::luaW_open ( lua_State L)