The Battle for Wesnoth  1.15.1+dev
Namespaces | Macros | Functions
lua_common.hpp File Reference
#include "config.hpp"
#include "variable_info.hpp"
#include "map/location.hpp"
#include "serialization/string_view.hpp"
#include <vector>
#include <string>
Include dependency graph for lua_common.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 lua_common
 

Macros

#define return_tstring_attrib(name, accessor)
 
#define return_cstring_attrib(name, accessor)
 
#define return_string_attrib(name, accessor)
 
#define return_int_attrib(name, accessor)
 
#define return_float_attrib(name, accessor)
 
#define return_bool_attrib(name, accessor)
 
#define return_cfg_attrib(name, accessor)
 
#define return_cfgref_attrib(name, accessor)
 
#define return_vector_string_attrib(name, accessor)
 
#define modify_tstring_attrib(name, accessor)
 
#define modify_string_attrib(name, accessor)
 
#define modify_int_attrib(name, accessor)
 
#define modify_int_attrib_check_range(name, accessor, allowed_min, allowed_max)
 
#define modify_float_attrib(name, accessor)
 
#define modify_float_attrib_check_range(name, accessor, allowed_min, allowed_max)
 
#define modify_bool_attrib(name, accessor)
 
#define modify_vector_string_attrib(name, accessor)
 

Functions

int lua_common::intf_textdomain (lua_State *L)
 Creates an interface for gettext. More...
 
int lua_common::intf_tovconfig (lua_State *L)
 Creates a vconfig containing the WML table. More...
 
std::string lua_common::register_gettext_metatable (lua_State *L)
 Adds the gettext metatable. More...
 
std::string lua_common::register_tstring_metatable (lua_State *L)
 Adds the tstring metatable. More...
 
std::string lua_common::register_vconfig_metatable (lua_State *L)
 Adds the vconfig metatable. More...
 
void * operator new (std::size_t sz, lua_State *L)
 
void operator delete (void *p, lua_State *L)
 
bool luaW_getmetafield (lua_State *L, int idx, const char *key)
 Like luaL_getmetafield, but returns false if key is an empty string or begins with two underscores. More...
 
void luaW_pushvconfig (lua_State *L, const vconfig &cfg)
 Pushes a vconfig on the top of the stack. More...
 
void luaW_pushtstring (lua_State *L, const t_string &v)
 Pushes a t_string on the top of the stack. More...
 
void luaW_pushscalar (lua_State *L, const config::attribute_value &v)
 Converts an attribute value into a Lua object pushed at the top of the stack. More...
 
bool luaW_toscalar (lua_State *L, int index, config::attribute_value &v)
 Converts the value at the top of the stack to an attribute value. More...
 
bool luaW_totstring (lua_State *L, int index, t_string &str)
 Converts a scalar to a translatable string. More...
 
t_string luaW_checktstring (lua_State *L, int index)
 Converts a scalar to a translatable string. More...
 
bool luaW_iststring (lua_State *L, int index)
 
void luaW_filltable (lua_State *L, const config &cfg)
 Converts a config object to a Lua table. More...
 
void luaW_pushlocation (lua_State *L, const map_location &loc)
 Converts a map location object to a Lua table pushed at the top of the stack. More...
 
bool luaW_tolocation (lua_State *L, int index, map_location &loc)
 Converts an optional table or pair of integers to a map location object. More...
 
map_location luaW_checklocation (lua_State *L, int index)
 Converts an optional table or pair of integers to a map location object. More...
 
void luaW_pushconfig (lua_State *L, const config &cfg)
 Converts a config object to a Lua table pushed at the top of the stack. More...
 
bool luaW_toconfig (lua_State *L, int index, config &cfg)
 Converts an optional table or vconfig to a config object. More...
 
config luaW_checkconfig (lua_State *L, int index)
 Converts an optional table or vconfig to a config object. More...
 
bool luaW_tovconfig (lua_State *L, int index, vconfig &vcfg)
 Gets an optional vconfig from either a table or a userdata. More...
 
vconfig luaW_checkvconfig (lua_State *L, int index, bool allow_missing=false)
 Gets an optional vconfig from either a table or a userdata. More...
 
config luaW_checkconfig (lua_State *L, int index, const vconfig *&vcfg)
 Like the two-argument version, but if it was a vconfig, also returns a pointer to that vconfig. More...
 
bool luaW_getglobal (lua_State *L, const std::vector< std::string > &path)
 Pushes the value found by following the variadic names (char *), if the value is not nil. More...
 
template<typename... T>
bool luaW_getglobal (lua_State *L, T... path)
 Pushes the value found by following the variadic names (char *), if the value is not nil. More...
 
bool luaW_toboolean (lua_State *L, int n)
 
bool luaW_pushvariable (lua_State *L, variable_access_const &v)
 
bool luaW_checkvariable (lua_State *L, variable_access_create &v, int n)
 
bool luaW_tableget (lua_State *L, int index, const char *key)
 
utils::string_view luaW_tostring (lua_State *L, int index)
 
utils::string_view luaW_tostring_or_default (lua_State *L, int index, utils::string_view def=utils::string_view())
 
void chat_message (const std::string &caption, const std::string &msg)
 Displays a message in the chat window. More...
 
bool luaW_pcall (lua_State *L, int nArgs, int nRets, bool allow_wml_error=false)
 Calls a Lua function stored below its nArgs arguments at the top of the stack. More...
 
void push_error_handler (lua_State *L)
 
int luaW_pcall_internal (lua_State *L, int nArgs, int nRets)
 
int luaW_type_error (lua_State *L, int narg, const char *tname)
 
int luaW_type_error (lua_State *L, int narg, const char *kpath, const char *tname)
 

Macro Definition Documentation

◆ modify_bool_attrib

#define modify_bool_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
bool value = luaW_toboolean(L, 3); \
{accessor;} \
return 0; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
bool luaW_toboolean(lua_State *L, int n)
Definition: lua_common.cpp:870

Definition at line 339 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_end_level_data_set(), game_lua_kernel::impl_game_config_set(), impl_side_set(), impl_track_set(), and impl_unit_set().

◆ modify_float_attrib

#define modify_float_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
lua_Number value = luaL_checknumber(L, 3); \
{accessor;} \
return 0; \
} \
} while(false)
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int arg)
Definition: lauxlib.cpp:408
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 320 of file lua_common.hpp.

◆ modify_float_attrib_check_range

#define modify_float_attrib_check_range (   name,
  accessor,
  allowed_min,
  allowed_max 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
lua_Number value = luaL_checknumber(L, 3); \
if (value < (allowed_min) || (allowed_max) < value) return luaL_argerror(L, 3, "out of bounds"); \
{accessor;} \
return 0; \
} \
} while(false)
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int arg)
Definition: lauxlib.cpp:408
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
Definition: lauxlib.cpp:164

Definition at line 329 of file lua_common.hpp.

Referenced by impl_music_set().

◆ modify_int_attrib

#define modify_int_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
int value = static_cast<int>(luaL_checknumber(L, 3)); \
{accessor;} \
return 0; \
} \
} while(false)
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int arg)
Definition: lauxlib.cpp:408
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 301 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_game_config_set(), impl_side_set(), impl_track_set(), impl_unit_attack_set(), and impl_unit_set().

◆ modify_int_attrib_check_range

#define modify_int_attrib_check_range (   name,
  accessor,
  allowed_min,
  allowed_max 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
int value = static_cast<int>(luaL_checknumber(L, 3)); \
if (value < (allowed_min) || (allowed_max) < value) return luaL_argerror(L, 3, "out of bounds"); \
{accessor;} \
return 0; \
} \
} while(false)
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int arg)
Definition: lauxlib.cpp:408
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
Definition: lauxlib.cpp:164

Definition at line 310 of file lua_common.hpp.

Referenced by impl_music_set().

◆ modify_string_attrib

#define modify_string_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
const char *value = luaL_checkstring(L, 3); \
{accessor;} \
return 0; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
#define luaL_checkstring(L, n)
Definition: lauxlib.h:124

Definition at line 292 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_game_config_set(), impl_side_set(), impl_track_set(), impl_unit_attack_set(), and impl_unit_set().

◆ modify_tstring_attrib

#define modify_tstring_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
t_string value = luaW_checktstring(L, 3); \
{accessor;} \
return 0; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
t_string luaW_checktstring(lua_State *L, int index)
Converts a scalar to a translatable string.
Definition: lua_common.cpp:602

Definition at line 283 of file lua_common.hpp.

Referenced by impl_side_set(), impl_unit_attack_set(), and impl_unit_set().

◆ modify_vector_string_attrib

#define modify_vector_string_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
std::vector<std::string> value; \
char const* message = "table with unnamed indices holding strings expected"; \
if (!lua_istable(L, 3)) return luaL_argerror(L, 3, message); \
unsigned length = lua_rawlen(L, 3); \
for (unsigned i = 1; i <= length; ++i) { \
lua_rawgeti(L, 3, i); \
char const* string = lua_tostring(L, 4); \
if(!string) return luaL_argerror(L, 2 + i, message); \
value.push_back(string); \
lua_pop(L, 1); \
} \
{accessor;} \
return 0; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
Definition: lauxlib.cpp:164
std::size_t i
Definition: function.cpp:933
#define lua_tostring(L, i)
Definition: lua.h:366
LUA_API size_t lua_rawlen(lua_State *L, int idx)
Definition: lapi.cpp:392
#define lua_istable(L, n)
Definition: lua.h:353

Definition at line 348 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_game_config_set(), and impl_unit_set().

◆ return_bool_attrib

#define return_bool_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
lua_pushboolean(L, (accessor)); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 242 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_current_get(), impl_end_level_data_get(), game_lua_kernel::impl_game_config_get(), lua_kernel_base::impl_game_config_get(), impl_race_get(), impl_side_get(), impl_track_get(), impl_unit_attack_get(), and impl_unit_get().

◆ return_cfg_attrib

#define return_cfg_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
config cfg; \
{accessor;} \
luaW_pushconfig(L, cfg); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 250 of file lua_common.hpp.

Referenced by impl_end_level_data_get(), impl_side_get(), impl_track_get(), and impl_unit_get().

◆ return_cfgref_attrib

#define return_cfgref_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
luaW_pushconfig(L, (accessor)); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 260 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_game_config_get(), impl_race_get(), impl_unit_attack_get(), impl_unit_type_get(), and impl_unit_variables_get().

◆ return_cstring_attrib

#define return_cstring_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
lua_pushstring(L, (accessor)); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 209 of file lua_common.hpp.

Referenced by impl_end_level_data_get(), and impl_side_get().

◆ return_float_attrib

#define return_float_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
lua_pushnumber(L, (accessor)); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 234 of file lua_common.hpp.

Referenced by impl_music_get(), and impl_side_get().

◆ return_int_attrib

#define return_int_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
lua_pushinteger(L, (accessor)); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 226 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_current_get(), game_lua_kernel::impl_game_config_get(), lua_kernel_base::impl_game_config_get(), impl_race_get(), impl_side_get(), impl_terainmap_get(), impl_track_get(), impl_unit_attack_get(), impl_unit_get(), and impl_unit_type_get().

◆ return_string_attrib

#define return_string_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
const std::string& str = (accessor); \
lua_pushlstring(L, str.c_str(), str.length()); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 217 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_current_get(), game_lua_kernel::impl_game_config_get(), lua_kernel_base::impl_game_config_get(), impl_race_get(), impl_side_get(), impl_terainmap_get(), impl_track_get(), impl_unit_attack_get(), impl_unit_get(), and impl_unit_type_get().

◆ return_tstring_attrib

#define return_tstring_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
luaW_pushtstring(L, (accessor)); \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48

Definition at line 201 of file lua_common.hpp.

Referenced by impl_race_get(), impl_side_get(), impl_unit_get(), and impl_unit_type_get().

◆ return_vector_string_attrib

#define return_vector_string_attrib (   name,
  accessor 
)
Value:
do { \
if (strcmp(m, (name)) == 0) { \
const std::vector<std::string>& vector = (accessor); \
lua_createtable(L, vector.size(), 0); \
int i = 1; \
for (const std::string& s : vector) { \
lua_pushlstring(L, s.c_str(), s.length()); \
lua_rawseti(L, -2, i); \
++i; \
} \
return 1; \
} \
} while(false)
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
std::size_t i
Definition: function.cpp:933
static map_location::DIRECTION s

Definition at line 268 of file lua_common.hpp.

Referenced by game_lua_kernel::impl_game_config_get(), impl_unit_get(), and impl_unit_type_get().

Function Documentation

◆ chat_message()

void chat_message ( const std::string &  caption,
const std::string &  msg 
)

◆ luaW_checkconfig() [1/2]

config luaW_checkconfig ( lua_State L,
int  index 
)

◆ luaW_checkconfig() [2/2]

config luaW_checkconfig ( lua_State L,
int  index,
const vconfig *&  vcfg 
)

Like the two-argument version, but if it was a vconfig, also returns a pointer to that vconfig.

Definition at line 807 of file lua_common.cpp.

References luaL_testudata(), luaW_checkconfig(), p, and vconfigKey.

◆ luaW_checklocation()

map_location luaW_checklocation ( lua_State L,
int  index 
)

◆ luaW_checktstring()

t_string luaW_checktstring ( lua_State L,
int  index 
)

◆ luaW_checkvariable()

bool luaW_checkvariable ( lua_State L,
variable_access_create v,
int  n 
)

◆ luaW_checkvconfig()

vconfig luaW_checkvconfig ( lua_State L,
int  index,
bool  allow_missing = false 
)

◆ luaW_filltable()

void luaW_filltable ( lua_State L,
const config cfg 
)

Converts a config object to a Lua table.

The destination table should be at the top of the stack on entry. It is still at the top on exit.

Definition at line 621 of file lua_common.cpp.

References config::all_children_range(), config::attribute_range(), lua_checkstack(), lua_createtable(), LUA_MINSTACK, lua_newtable, lua_pushstring(), lua_rawseti(), lua_setfield(), luaW_filltable(), and luaW_pushscalar().

Referenced by luaW_filltable(), luaW_pushconfig(), and luaW_pushvariable().

◆ luaW_getglobal() [1/2]

bool luaW_getglobal ( lua_State L,
const std::vector< std::string > &  path 
)

◆ luaW_getglobal() [2/2]

template<typename... T>
bool luaW_getglobal ( lua_State L,
T...  path 
)

Pushes the value found by following the variadic names (char *), if the value is not nil.

Returns
true if an element was pushed.

Definition at line 166 of file lua_common.hpp.

References chat_message(), utf8::index(), luaW_checkvariable(), luaW_getglobal(), luaW_pcall(), luaW_pcall_internal(), luaW_pushvariable(), luaW_tableget(), luaW_toboolean(), luaW_tostring(), luaW_tostring_or_default(), luaW_type_error(), wfl::msg(), n, game_config::path, and push_error_handler().

◆ luaW_getmetafield()

bool luaW_getmetafield ( lua_State L,
int  idx,
const char *  key 
)

Like luaL_getmetafield, but returns false if key is an empty string or begins with two underscores.

Definition at line 494 of file lua_common.cpp.

References luaL_getmetafield(), and n.

Referenced by impl_animator_get(), impl_music_get(), impl_side_get(), impl_terainmap_get(), impl_track_get(), impl_unit_attack_get(), and impl_unit_get().

◆ luaW_iststring()

bool luaW_iststring ( lua_State L,
int  index 
)

◆ luaW_pcall()

bool luaW_pcall ( lua_State L,
int  nArgs,
int  nRets,
bool  allow_wml_error = false 
)

◆ luaW_pcall_internal()

int luaW_pcall_internal ( lua_State L,
int  nArgs,
int  nRets 
)

◆ luaW_pushconfig()

void luaW_pushconfig ( lua_State L,
const config cfg 
)

◆ luaW_pushlocation()

void luaW_pushlocation ( lua_State L,
const map_location loc 
)

◆ luaW_pushscalar()

void luaW_pushscalar ( lua_State L,
const config::attribute_value v 
)

Converts an attribute value into a Lua object pushed at the top of the stack.

Definition at line 545 of file lua_common.cpp.

References config_attribute_value::apply_visitor().

Referenced by impl_preferences_get(), lua_common::impl_vconfig_get(), lua_common::impl_vconfig_pairs_iter(), luaW_filltable(), and luaW_pushvariable().

◆ luaW_pushtstring()

void luaW_pushtstring ( lua_State L,
const t_string v 
)

◆ luaW_pushvariable()

bool luaW_pushvariable ( lua_State L,
variable_access_const v 
)

◆ luaW_pushvconfig()

void luaW_pushvconfig ( lua_State L,
const vconfig cfg 
)

◆ luaW_tableget()

bool luaW_tableget ( lua_State L,
int  index,
const char *  key 
)

◆ luaW_toboolean()

bool luaW_toboolean ( lua_State L,
int  n 
)

Definition at line 870 of file lua_common.cpp.

References lua_toboolean().

Referenced by ai::ai_move(), ai::call_lua_filter_fcn(), game_lua_kernel::cfun_builtin_effect(), cfun_exec_candidate_action(), impl_add_animation(), ai::impl_ai_get(), impl_unit_status_set(), intf_add_modification(), intf_advance_unit(), game_lua_kernel::intf_allow_end_turn(), game_lua_kernel::intf_allow_undo(), game_lua_kernel::intf_delay(), game_lua_kernel::intf_find_cost_map(), intf_find_path(), game_lua_kernel::intf_find_reach(), game_lua_kernel::intf_get_time_of_day(), lua_fileops::intf_have_file(), intf_load_wml(), game_lua_kernel::intf_lock_view(), game_lua_kernel::intf_log(), intf_music_add(), game_lua_kernel::intf_put_unit(), game_lua_kernel::intf_redraw(), game_lua_kernel::intf_scroll_to_tile(), game_lua_kernel::intf_select_hex(), game_lua_kernel::intf_select_unit(), lua_gui2::intf_set_dialog_active(), lua_gui2::intf_set_dialog_markup(), lua_gui2::intf_set_dialog_value(), lua_gui2::intf_set_dialog_visible(), game_lua_kernel::intf_set_end_campaign_credits(), game_lua_kernel::intf_set_terrain(), game_lua_kernel::intf_set_village_owner(), game_lua_kernel::intf_skip_messages(), game_lua_kernel::intf_teleport(), game_lua_kernel::intf_terrain_mask(), game_lua_kernel::intf_toggle_fog(), intf_unit_resistance(), game_lua_kernel::intf_zoom(), ai::lua_ai_load::lua_ai_load(), lua_check_impl::lua_check(), lua_check_impl::lua_to_or_default(), luaW_checkvariable(), luaW_getglobal(), luaW_toscalar(), read_rules_vector(), game_lua_kernel::run_filter(), game_lua_kernel::run_wml_conditional(), lua_gui2::show_menu(), lua_gui2::show_message_box(), and ai::lua_object< T >::to_type().

◆ luaW_toconfig()

bool luaW_toconfig ( lua_State L,
int  index,
config cfg 
)

◆ luaW_tolocation()

bool luaW_tolocation ( lua_State L,
int  index,
map_location loc 
)

◆ luaW_toscalar()

bool luaW_toscalar ( lua_State L,
int  index,
config::attribute_value v 
)

Converts the value at the top of the stack to an attribute value.

Definition at line 550 of file lua_common.cpp.

References LUA_TBOOLEAN, LUA_TNUMBER, lua_tonumber, lua_tostring, LUA_TSTRING, LUA_TUSERDATA, lua_type(), luaL_testudata(), luaW_toboolean(), and tstringKey.

Referenced by impl_preferences_set(), and luaW_toconfig().

◆ luaW_tostring()

utils::string_view luaW_tostring ( lua_State L,
int  index 
)

◆ luaW_tostring_or_default()

utils::string_view luaW_tostring_or_default ( lua_State L,
int  index,
utils::string_view  def = utils::string_view() 
)

Definition at line 971 of file lua_common.cpp.

References lua_tolstring().

Referenced by lua_check_impl::lua_to_or_default(), and luaW_getglobal().

◆ luaW_totstring()

bool luaW_totstring ( lua_State L,
int  index,
t_string str 
)

◆ luaW_tovconfig()

bool luaW_tovconfig ( lua_State L,
int  index,
vconfig vcfg 
)

Gets an optional vconfig from either a table or a userdata.

Returns
false in case of failure.

Definition at line 816 of file lua_common.cpp.

References LUA_TNIL, LUA_TNONE, LUA_TTABLE, LUA_TUSERDATA, lua_type(), luaL_testudata(), luaW_toconfig(), and vconfigKey.

Referenced by game_lua_kernel::intf_find_cost_map(), luaW_checkvconfig(), luaW_tofaivariant(), luaW_tolocation(), and ai::lua_object< T >::to_type().

◆ luaW_type_error() [1/2]

int luaW_type_error ( lua_State L,
int  narg,
const char *  tname 
)

◆ luaW_type_error() [2/2]

int luaW_type_error ( lua_State L,
int  narg,
const char *  kpath,
const char *  tname 
)

Definition at line 1066 of file lua_common.cpp.

References lua_pushfstring(), luaL_argerror(), luaL_typename, and wfl::msg().

◆ operator delete()

void operator delete ( void *  p,
lua_State L 
)

Definition at line 486 of file lua_common.cpp.

References lua_pop.

◆ operator new()

void* operator new ( std::size_t  sz,
lua_State L 
)

Definition at line 481 of file lua_common.cpp.

References lua_newuserdata().

◆ push_error_handler()

void push_error_handler ( lua_State L)