The Battle for Wesnoth  1.19.7+dev
Functions
lua_stringx Namespace Reference

Functions

static int intf_format (lua_State *L)
 Formats a message by interpolating WML variable syntax Arg 1: (optional) Logger Arg 2: Message. More...
 
template<bool conjunct>
static int intf_format_list (lua_State *L)
 Formats a list into human-readable format Arg 1: default value, used if the list is empty Arg 2: list of strings. More...
 
static int impl_str_index (lua_State *L)
 Enables indexing a string by an integer, while also treating the stringx module as its metatable.__index. More...
 
static int intf_str_split (lua_State *L)
 Splits a string into parts according to options Arg 1: String to split Arg 2: Separator Arg 3: Options table. More...
 
static int intf_str_paren_split (lua_State *L)
 Splits a string into parenthesized portions and portions between parenthesized portions Arg 1: String to split Arg 2: Possible left parentheses Arg 3: Matching right parentheses. More...
 
static int intf_str_map_split (lua_State *L)
 Splits a string into a map Arg 1: string to split Arg 2: Separator for items Arg 3: Separator for key and value. More...
 
static int intf_str_join (lua_State *L)
 Joins a list into a string; calls __tostring and __index metamethods Arg 1: list to join Arg 2: separator (arguments can be swapped) More...
 
static int intf_str_join_map (lua_State *L)
 Joins a map into a string; calls __tostring metamethods (on both key and value) but not __index Arg 1: list to join Arg 2: separator for items Arg 3: separator for key and value (list argument can be swapped to any position) More...
 
static int intf_str_trim (lua_State *L)
 Trims whitespace from the beginning and end of a string. More...
 
static int intf_str_format (lua_State *L)
 
static int intf_parse_range (lua_State *L)
 Parses a range string of the form a-b into an interval pair Accepts the string "infinity" as representing a Very Large Number Arg 2: (optional) If true, parse as real numbers instead of integers. More...
 
int luaW_open (lua_State *L)
 

Function Documentation

◆ impl_str_index()

static int lua_stringx::impl_str_index ( lua_State *  L)
static

Enables indexing a string by an integer, while also treating the stringx module as its metatable.__index.

Definition at line 65 of file lua_stringx.cpp.

References i, and luaW_getglobal().

Referenced by luaW_open().

◆ intf_format()

static int lua_stringx::intf_format ( lua_State *  L)
static

Formats a message by interpolating WML variable syntax Arg 1: (optional) Logger Arg 2: Message.

Definition at line 34 of file lua_stringx.cpp.

References utils::interpolate_variables_into_string(), utils::interpolate_variables_into_tstring(), lua_push(), luaW_checkconfig(), and luaW_checktstring().

Referenced by luaW_open().

◆ intf_format_list()

template<bool conjunct>
static int lua_stringx::intf_format_list ( lua_State *  L)
static

Formats a list into human-readable format Arg 1: default value, used if the list is empty Arg 2: list of strings.

Definition at line 54 of file lua_stringx.cpp.

References utils::format_conjunct_list(), utils::format_disjunct_list(), lua_push(), and luaW_checktstring().

◆ intf_parse_range()

static int lua_stringx::intf_parse_range ( lua_State *  L)
static

Parses a range string of the form a-b into an interval pair Accepts the string "infinity" as representing a Very Large Number Arg 2: (optional) If true, parse as real numbers instead of integers.

Definition at line 331 of file lua_stringx.cpp.

References utils::parse_range(), and utils::parse_range_real().

Referenced by luaW_open().

◆ intf_str_format()

static int lua_stringx::intf_str_format ( lua_State *  L)
static

Definition at line 306 of file lua_stringx.cpp.

References luaW_iststring().

Referenced by luaW_open().

◆ intf_str_join()

static int lua_stringx::intf_str_join ( lua_State *  L)
static

Joins a list into a string; calls __tostring and __index metamethods Arg 1: list to join Arg 2: separator (arguments can be swapped)

Definition at line 228 of file lua_stringx.cpp.

References i, utils::join(), and lua_push().

Referenced by luaW_open().

◆ intf_str_join_map()

static int lua_stringx::intf_str_join_map ( lua_State *  L)
static

Joins a map into a string; calls __tostring metamethods (on both key and value) but not __index Arg 1: list to join Arg 2: separator for items Arg 3: separator for key and value (list argument can be swapped to any position)

Definition at line 258 of file lua_stringx.cpp.

References utils::join_map(), and lua_push().

Referenced by luaW_open().

◆ intf_str_map_split()

static int lua_stringx::intf_str_map_split ( lua_State *  L)
static

Splits a string into a map Arg 1: string to split Arg 2: Separator for items Arg 3: Separator for key and value.

Definition at line 193 of file lua_stringx.cpp.

References lua_push(), luaW_table_get_def(), luaW_tableget(), utils::map_split(), utils::REMOVE_EMPTY, and utils::STRIP_SPACES.

Referenced by luaW_open().

◆ intf_str_paren_split()

static int lua_stringx::intf_str_paren_split ( lua_State *  L)
static

Splits a string into parenthesized portions and portions between parenthesized portions Arg 1: String to split Arg 2: Possible left parentheses Arg 3: Matching right parentheses.

Definition at line 174 of file lua_stringx.cpp.

References lua_push(), luaW_toboolean(), utils::parenthetical_split(), and utils::STRIP_SPACES.

Referenced by luaW_open().

◆ intf_str_split()

static int lua_stringx::intf_str_split ( lua_State *  L)
static

Splits a string into parts according to options Arg 1: String to split Arg 2: Separator Arg 3: Options table.

Definition at line 99 of file lua_stringx.cpp.

References lua_push(), luaW_table_get_def(), luaW_tableget(), utils::parenthetical_split(), utils::quoted_split(), utils::REMOVE_EMPTY, utils::split(), utils::square_parenthetical_split(), and utils::STRIP_SPACES.

Referenced by luaW_open().

◆ intf_str_trim()

static int lua_stringx::intf_str_trim ( lua_State *  L)
static

Trims whitespace from the beginning and end of a string.

Definition at line 297 of file lua_stringx.cpp.

References utils::trim().

Referenced by luaW_open().

◆ luaW_open()

int lua_stringx::luaW_open ( lua_State *  L)