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. More... | |
int | luaW_open (lua_State *L) |
|
static |
Enables indexing a string by an integer, while also treating the stringx module as its metatable.__index.
Definition at line 66 of file lua_stringx.cpp.
References lua_call, lua_getglobal(), lua_gettable(), lua_pushvalue(), LUA_TNUMBER, LUA_TSTRING, lua_type(), and luaW_getglobal().
Referenced by luaW_open().
|
static |
Formats a message by interpolating WML variable syntax Arg 1: (optional) Logger Arg 2: Message.
Definition at line 35 of file lua_stringx.cpp.
References utils::interpolate_variables_into_string(), utils::interpolate_variables_into_tstring(), lua_isstring(), lua_push(), lua_tostring, luaW_checkconfig(), and luaW_checktstring().
Referenced by luaW_open().
|
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 55 of file lua_stringx.cpp.
References utils::format_conjunct_list(), utils::format_disjunct_list(), lua_push(), and luaW_checktstring().
|
static |
Parses a range string of the form a-b into an interval pair Accepts the string "infinity" as representing a Very Large Number.
Definition at line 323 of file lua_stringx.cpp.
References lua_pushnumber(), luaL_checkstring, and utils::parse_range().
Referenced by luaW_open().
|
static |
Definition at line 299 of file lua_stringx.cpp.
References lua_call, lua_getglobal(), lua_gettop(), lua_insert, lua_pushvalue(), lua_replace, lua_upvalueindex, and luaW_iststring().
Referenced by luaW_open().
|
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 221 of file lua_stringx.cpp.
References i, utils::join(), lua_call, lua_getglobal(), lua_geti(), lua_istable, lua_push(), luaL_checkstring, luaL_error(), luaL_len(), and luaL_optstring.
Referenced by luaW_open().
|
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 251 of file lua_stringx.cpp.
References utils::join_map(), lua_absindex(), lua_call, lua_getglobal(), lua_istable, lua_next(), lua_push(), lua_pushnil(), lua_pushvalue(), lua_settop(), luaL_checkstring, luaL_error(), and luaL_optstring.
Referenced by luaW_open().
|
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 186 of file lua_stringx.cpp.
References lua_istable, lua_push(), luaL_checkstring, luaL_error(), luaL_optstring, luaW_table_get_def(), luaW_tableget(), utils::map_split(), utils::REMOVE_EMPTY, and utils::STRIP_SPACES.
Referenced by luaW_open().
|
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 167 of file lua_stringx.cpp.
References left, lua_push(), luaL_checkstring, luaL_error(), luaL_opt, luaL_optstring, luaW_toboolean(), utils::parenthetical_split(), right, and utils::STRIP_SPACES.
Referenced by luaW_open().
|
static |
Splits a string into parts according to options Arg 1: String to split Arg 2: Separator Arg 3: Options table.
Definition at line 92 of file lua_stringx.cpp.
References left, lua_istable, lua_push(), luaL_checkstring, luaL_error(), luaL_optstring, luaW_table_get_def(), luaW_tableget(), utils::parenthetical_split(), utils::quoted_split(), utils::REMOVE_EMPTY, right, utils::split(), utils::square_parenthetical_split(), and utils::STRIP_SPACES.
Referenced by luaW_open().
|
static |
Trims whitespace from the beginning and end of a string.
Definition at line 290 of file lua_stringx.cpp.
References lua_pushlstring(), luaL_checkstring, and utils::trim().
Referenced by luaW_open().
int lua_stringx::luaW_open | ( | lua_State * | L | ) |
Definition at line 332 of file lua_stringx.cpp.
References impl_str_index(), intf_format(), intf_parse_range(), intf_str_format(), intf_str_join(), intf_str_join_map(), intf_str_map_split(), intf_str_paren_split(), intf_str_split(), intf_str_trim(), lua_createtable(), lua_getfield(), lua_getglobal(), lua_getmetatable(), lua_newtable, lua_pop, lua_pushcclosure(), lua_pushcfunction, lua_pushliteral, lua_setfield(), lua_setmetatable(), and luaL_setfuncs().
Referenced by lua_kernel_base::lua_kernel_base().