The Battle for Wesnoth  1.15.1+dev
Classes | Macros | Functions | Variables
lapi.cpp File Reference
#include "lprefix.h"
#include <stdarg.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include "lundump.h"
#include "lvm.h"
Include dependency graph for lapi.cpp:

Go to the source code of this file.

Classes

struct  CallS
 

Macros

#define lapi_c
 
#define LUA_CORE
 
#define NONVALIDVALUE   cast(TValue *, luaO_nilobject)
 
#define isvalid(o)   ((o) != luaO_nilobject)
 
#define ispseudo(i)   ((i) <= LUA_REGISTRYINDEX)
 
#define isupvalue(i)   ((i) < LUA_REGISTRYINDEX)
 
#define isstackindex(i, o)   (isvalid(o) && !ispseudo(i))
 
#define api_checkvalidindex(l, o)   api_check(l, isvalid(o), "invalid index")
 
#define api_checkstackindex(l, i, o)   api_check(l, isstackindex(i, o), "index not in the stack")
 
#define checkresults(L, na, nr)
 

Functions

static TValueindex2addr (lua_State *L, int idx)
 
static void growstack (lua_State *L, void *ud)
 
LUA_API int lua_checkstack (lua_State *L, int n)
 
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n)
 
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf)
 
LUA_API const lua_Numberlua_version (lua_State *L)
 
LUA_API int lua_absindex (lua_State *L, int idx)
 
LUA_API int lua_gettop (lua_State *L)
 
LUA_API void lua_settop (lua_State *L, int idx)
 
static void reverse (lua_State *L, StkId from, StkId to)
 
LUA_API void lua_rotate (lua_State *L, int idx, int n)
 
LUA_API void lua_copy (lua_State *L, int fromidx, int toidx)
 
LUA_API void lua_pushvalue (lua_State *L, int idx)
 
LUA_API int lua_type (lua_State *L, int idx)
 
LUA_API const char * lua_typename (lua_State *L, int t)
 
LUA_API int lua_iscfunction (lua_State *L, int idx)
 
LUA_API int lua_isinteger (lua_State *L, int idx)
 
LUA_API int lua_isnumber (lua_State *L, int idx)
 
LUA_API int lua_isstring (lua_State *L, int idx)
 
LUA_API int lua_isuserdata (lua_State *L, int idx)
 
LUA_API int lua_rawequal (lua_State *L, int index1, int index2)
 
LUA_API void lua_arith (lua_State *L, int op)
 
LUA_API int lua_compare (lua_State *L, int index1, int index2, int op)
 
LUA_API size_t lua_stringtonumber (lua_State *L, const char *s)
 
LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum)
 
LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum)
 
LUA_API int lua_toboolean (lua_State *L, int idx)
 
LUA_API const char * lua_tolstring (lua_State *L, int idx, size_t *len)
 
LUA_API size_t lua_rawlen (lua_State *L, int idx)
 
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx)
 
LUA_API void * lua_touserdata (lua_State *L, int idx)
 
LUA_API lua_Statelua_tothread (lua_State *L, int idx)
 
LUA_API const void * lua_topointer (lua_State *L, int idx)
 
LUA_API void lua_pushnil (lua_State *L)
 
LUA_API void lua_pushnumber (lua_State *L, lua_Number n)
 
LUA_API void lua_pushinteger (lua_State *L, lua_Integer n)
 
LUA_API const char * lua_pushlstring (lua_State *L, const char *s, size_t len)
 
LUA_API const char * lua_pushstring (lua_State *L, const char *s)
 
LUA_API const char * lua_pushvfstring (lua_State *L, const char *fmt, va_list argp)
 
LUA_API const char * lua_pushfstring (lua_State *L, const char *fmt,...)
 
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n)
 
LUA_API void lua_pushboolean (lua_State *L, int b)
 
LUA_API void lua_pushlightuserdata (lua_State *L, void *p)
 
LUA_API int lua_pushthread (lua_State *L)
 
static int auxgetstr (lua_State *L, const TValue *t, const char *k)
 
LUA_API int lua_getglobal (lua_State *L, const char *name)
 
LUA_API int lua_gettable (lua_State *L, int idx)
 
LUA_API int lua_getfield (lua_State *L, int idx, const char *k)
 
LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n)
 
LUA_API int lua_rawget (lua_State *L, int idx)
 
LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n)
 
LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p)
 
LUA_API void lua_createtable (lua_State *L, int narray, int nrec)
 
LUA_API int lua_getmetatable (lua_State *L, int objindex)
 
LUA_API int lua_getuservalue (lua_State *L, int idx)
 
static void auxsetstr (lua_State *L, const TValue *t, const char *k)
 
LUA_API void lua_setglobal (lua_State *L, const char *name)
 
LUA_API void lua_settable (lua_State *L, int idx)
 
LUA_API void lua_setfield (lua_State *L, int idx, const char *k)
 
LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n)
 
LUA_API void lua_rawset (lua_State *L, int idx)
 
LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n)
 
LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p)
 
LUA_API int lua_setmetatable (lua_State *L, int objindex)
 
LUA_API void lua_setuservalue (lua_State *L, int idx)
 
LUA_API void lua_callk (lua_State *L, int nargs, int nresults, lua_KContext ctx, lua_KFunction k)
 
static void f_call (lua_State *L, void *ud)
 
LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, lua_KContext ctx, lua_KFunction k)
 
LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode)
 
LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip)
 
LUA_API int lua_status (lua_State *L)
 
LUA_API int lua_gc (lua_State *L, int what, int data)
 
LUA_API int lua_error (lua_State *L)
 
LUA_API int lua_next (lua_State *L, int idx)
 
LUA_API void lua_concat (lua_State *L, int n)
 
LUA_API void lua_len (lua_State *L, int idx)
 
LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud)
 
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud)
 
LUA_API void * lua_newuserdata (lua_State *L, size_t size)
 
static const char * aux_upvalue (StkId fi, int n, TValue **val, CClosure **owner, UpVal **uv)
 
LUA_API const char * lua_getupvalue (lua_State *L, int funcindex, int n)
 
LUA_API const char * lua_setupvalue (lua_State *L, int funcindex, int n)
 
static UpVal ** getupvalref (lua_State *L, int fidx, int n, LClosure **pf)
 
LUA_API void * lua_upvalueid (lua_State *L, int fidx, int n)
 
LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, int fidx2, int n2)
 

Variables

const char lua_ident []
 

Macro Definition Documentation

◆ api_checkstackindex

#define api_checkstackindex (   l,
  i,
 
)    api_check(l, isstackindex(i, o), "index not in the stack")

Definition at line 56 of file lapi.cpp.

Referenced by lua_pcallk(), and lua_rotate().

◆ api_checkvalidindex

#define api_checkvalidindex (   l,
 
)    api_check(l, isvalid(o), "invalid index")

Definition at line 54 of file lapi.cpp.

Referenced by lua_copy().

◆ checkresults

#define checkresults (   L,
  na,
  nr 
)
Value:
api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \
"results from function overflow current stack size")
#define LUA_MULTRET
Definition: lua.h:34
#define api_check(l, e, msg)
Definition: llimits.h:101

Definition at line 904 of file lapi.cpp.

Referenced by lua_callk(), and lua_pcallk().

◆ ispseudo

#define ispseudo (   i)    ((i) <= LUA_REGISTRYINDEX)

Definition at line 46 of file lapi.cpp.

Referenced by index2addr(), and lua_absindex().

◆ isstackindex

#define isstackindex (   i,
 
)    (isvalid(o) && !ispseudo(i))

Definition at line 52 of file lapi.cpp.

◆ isupvalue

#define isupvalue (   i)    ((i) < LUA_REGISTRYINDEX)

Definition at line 49 of file lapi.cpp.

Referenced by lua_copy().

◆ isvalid

#define isvalid (   o)    ((o) != luaO_nilobject)

Definition at line 43 of file lapi.cpp.

Referenced by lua_compare(), lua_rawequal(), and lua_type().

◆ lapi_c

#define lapi_c

Definition at line 7 of file lapi.cpp.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lapi.cpp.

◆ NONVALIDVALUE

#define NONVALIDVALUE   cast(TValue *, luaO_nilobject)

Definition at line 40 of file lapi.cpp.

Referenced by index2addr().

Function Documentation

◆ aux_upvalue()

static const char* aux_upvalue ( StkId  fi,
int  n,
TValue **  val,
CClosure **  owner,
UpVal **  uv 
)
static

◆ auxgetstr()

static int auxgetstr ( lua_State L,
const TValue t,
const char *  k 
)
static

◆ auxsetstr()

static void auxsetstr ( lua_State L,
const TValue t,
const char *  k 
)
static

◆ f_call()

static void f_call ( lua_State L,
void *  ud 
)
static

Definition at line 941 of file lapi.cpp.

References c, cast, CallS::func, luaD_callnoyield(), and CallS::nresults.

Referenced by lua_pcallk().

◆ getupvalref()

static UpVal** getupvalref ( lua_State L,
int  fidx,
int  n,
LClosure **  pf 
)
static

Definition at line 1257 of file lapi.cpp.

References api_check, clLvalue, f, index2addr(), p, ttisLclosure, and LClosure::upvals.

Referenced by lua_upvalueid(), and lua_upvaluejoin().

◆ growstack()

static void growstack ( lua_State L,
void *  ud 
)
static

Definition at line 91 of file lapi.cpp.

References luaD_growstack(), and utf8::size().

Referenced by lua_checkstack().

◆ index2addr()

static TValue* index2addr ( lua_State L,
int  idx 
)
static

◆ lua_absindex()

LUA_API int lua_absindex ( lua_State L,
int  idx 
)

◆ lua_arith()

LUA_API void lua_arith ( lua_State L,
int  op 
)

◆ lua_atpanic()

LUA_API lua_CFunction lua_atpanic ( lua_State L,
lua_CFunction  panicf 
)

Definition at line 134 of file lapi.cpp.

References G, lua_lock, and lua_unlock.

Referenced by luaL_newstate().

◆ lua_callk()

LUA_API void lua_callk ( lua_State L,
int  nargs,
int  nresults,
lua_KContext  ctx,
lua_KFunction  k 
)

◆ lua_checkstack()

LUA_API int lua_checkstack ( lua_State L,
int  n 
)

◆ lua_compare()

LUA_API int lua_compare ( lua_State L,
int  index1,
int  index2,
int  op 
)

◆ lua_concat()

LUA_API void lua_concat ( lua_State L,
int  n 
)

◆ lua_copy()

LUA_API void lua_copy ( lua_State L,
int  fromidx,
int  toidx 
)

◆ lua_createtable()

LUA_API void lua_createtable ( lua_State L,
int  narray,
int  nrec 
)

◆ lua_dump()

LUA_API int lua_dump ( lua_State L,
lua_Writer  writer,
void *  data,
int  strip 
)

Definition at line 1016 of file lapi.cpp.

References api_checknelems, getproto, isLfunction, lua_lock, lua_unlock, luaU_dump(), and lua_State::top.

Referenced by str_dump().

◆ lua_error()

LUA_API int lua_error ( lua_State L)

◆ lua_gc()

LUA_API int lua_gc ( lua_State L,
int  what,
int  data 
)

◆ lua_getallocf()

LUA_API lua_Alloc lua_getallocf ( lua_State L,
void **  ud 
)

Definition at line 1166 of file lapi.cpp.

References f, G, lua_lock, and lua_unlock.

Referenced by resizebox().

◆ lua_getfield()

LUA_API int lua_getfield ( lua_State L,
int  idx,
const char *  k 
)

◆ lua_getglobal()

LUA_API int lua_getglobal ( lua_State L,
const char *  name 
)

◆ lua_geti()

LUA_API int lua_geti ( lua_State L,
int  idx,
lua_Integer  n 
)

◆ lua_getmetatable()

LUA_API int lua_getmetatable ( lua_State L,
int  objindex 
)

◆ lua_gettable()

LUA_API int lua_gettable ( lua_State L,
int  idx 
)

◆ lua_gettop()

LUA_API int lua_gettop ( lua_State L)

Definition at line 167 of file lapi.cpp.

References cast_int, lua_State::ci, CallInfo::func, and lua_State::top.

Referenced by game_lua_kernel::apply_effect(), aux_lines(), auxresume(), ai::cfun_ai_get_attacks(), ai::cfun_attack_rating(), lua_callable::do_compare(), dofilecont(), finishpcall(), g_read(), g_write(), ai::lua_ai_context::get_arguments(), lua_kernel_base::get_attribute_names(), lua_kernel_base::get_global_var_names(), ai::lua_ai_context::get_persistent_data(), ai::lua_ai_action_handler::handle(), impl_context_accessor(), lua_gui2::intf_add_dialog_tree_node(), lua_kernel_base::intf_dofile(), game_lua_kernel::intf_find_path(), lua_gui2::intf_get_dialog_value(), lua_map_location::intf_get_direction(), game_lua_kernel::intf_log_replay(), intf_music_add(), intf_music_remove(), lua_kernel_base::intf_print(), lua_gui2::intf_remove_dialog_item(), lua_gui2::intf_set_dialog_active(), lua_gui2::intf_set_dialog_callback(), lua_gui2::intf_set_dialog_canvas(), lua_gui2::intf_set_dialog_markup(), lua_gui2::intf_set_dialog_tooltip(), lua_gui2::intf_set_dialog_value(), lua_gui2::intf_set_dialog_visible(), ll_require(), load_fake_units(), luaB_assert(), luaB_auxwrap(), luaB_coresume(), luaB_costatus(), luaB_pcall(), luaB_print(), luaB_select(), luaB_xpcall(), luaB_yield(), luaL_loadfilex(), luaL_traceback(), luaW_pcall_internal(), luaW_toconfig(), mapgen_lua_kernel::mapgen_lua_kernel(), math_max(), math_min(), math_random(), pack(), game_lua_kernel::push_builtin_effect(), ai::push_movements(), pushglobalfuncname(), ai::lua_ai_context::set_arguments(), ai::lua_ai_context::set_persistent_data(), str_char(), str_format(), tinsert(), and utfchar().

◆ lua_getupvalue()

LUA_API const char* lua_getupvalue ( lua_State L,
int  funcindex,
int  n 
)

Definition at line 1222 of file lapi.cpp.

References api_incr_top, aux_upvalue(), index2addr(), lua_lock, lua_unlock, name(), setobj2s, and lua_State::top.

Referenced by auxupvalue(), and checkupval().

◆ lua_getuservalue()

LUA_API int lua_getuservalue ( lua_State L,
int  idx 
)

◆ lua_iscfunction()

LUA_API int lua_iscfunction ( lua_State L,
int  idx 
)

Definition at line 264 of file lapi.cpp.

References index2addr(), ttisCclosure, and ttislcf.

Referenced by db_upvaluejoin(), and ll_require().

◆ lua_isinteger()

LUA_API int lua_isinteger ( lua_State L,
int  idx 
)

◆ lua_isnumber()

LUA_API int lua_isnumber ( lua_State L,
int  idx 
)

◆ lua_isstring()

LUA_API int lua_isstring ( lua_State L,
int  idx 
)

◆ lua_isuserdata()

LUA_API int lua_isuserdata ( lua_State L,
int  idx 
)

◆ lua_len()

LUA_API void lua_len ( lua_State L,
int  idx 
)

◆ lua_load()

LUA_API int lua_load ( lua_State L,
lua_Reader  reader,
void *  data,
const char *  chunkname,
const char *  mode 
)

◆ lua_newuserdata()

LUA_API void* lua_newuserdata ( lua_State L,
size_t  size 
)

◆ lua_next()

LUA_API int lua_next ( lua_State L,
int  idx 
)

◆ lua_pcallk()

LUA_API int lua_pcallk ( lua_State L,
int  nargs,
int  nresults,
int  errfunc,
lua_KContext  ctx,
lua_KFunction  k 
)

◆ lua_pushboolean()

LUA_API void lua_pushboolean ( lua_State L,
int  b 
)

Definition at line 557 of file lapi.cpp.

References api_incr_top, lua_lock, lua_unlock, setbvalue, and lua_State::top.

Referenced by aux_lines(), ai::cfun_ai_get_leader_ignores_keep(), ai::cfun_ai_get_passive_leader(), ai::cfun_ai_get_passive_leader_shares_keep(), ai::cfun_ai_get_simple_targeting(), ai::cfun_ai_get_support_villages(), ai::cfun_ai_is_dst_src_enemy_valid(), ai::cfun_ai_is_dst_src_valid(), ai::cfun_ai_is_src_dst_enemy_valid(), ai::cfun_ai_is_src_dst_valid(), cfun_wml_condition(), finishpcall(), ai::impl_ai_aspect_get(), impl_side_equal(), impl_track_eq(), lua_common::impl_tstring_eq(), lua_common::impl_tstring_le(), lua_common::impl_tstring_lt(), impl_unit_attack_equal(), impl_unit_attack_match(), impl_unit_equality(), impl_unit_status_get(), impl_unit_type_equal(), intf_compare_versions(), intf_eval_conditional(), game_lua_kernel::intf_fire_event(), game_lua_kernel::intf_fire_wml_menu_item(), lua_gui2::intf_get_dialog_value(), game_lua_kernel::intf_get_fog_or_shroud(), game_lua_kernel::intf_get_terrain_info(), intf_get_viewing_side(), lua_fileops::intf_have_file(), game_lua_kernel::intf_is_enemy(), game_lua_kernel::intf_is_skipping_messages(), game_lua_kernel::intf_match_location(), game_lua_kernel::intf_match_side(), game_lua_kernel::intf_match_unit(), lua_map_location::intf_tiles_adjacent(), game_lua_kernel::intf_unit_ability(), game_lua_kernel::intf_view_locked(), intf_wml_matches_filter(), ll_require(), lookforfunc(), ai::lua_ai_load::lua_ai_load(), lua_check_impl::lua_push(), luaB_collectgarbage(), luaB_coresume(), luaB_corunning(), luaB_pcall(), luaB_rawequal(), luaB_xpcall(), luaB_yieldable(), luaL_execresult(), luaL_fileresult(), luaW_pushsimweapon(), luaW_pushtstring(), math_ult(), os_execute(), ai::push_attack_analysis(), game_lua_kernel::push_builtin_effect(), setboolfield(), settabsb(), lua_gui2::show_message_box(), ai::transform_ai_action(), and ai::lua_ai_load::~lua_ai_load().

◆ lua_pushcclosure()

LUA_API void lua_pushcclosure ( lua_State L,
lua_CFunction  fn,
int  n 
)

◆ lua_pushfstring()

LUA_API const char* lua_pushfstring ( lua_State L,
const char *  fmt,
  ... 
)

◆ lua_pushinteger()

LUA_API void lua_pushinteger ( lua_State L,
lua_Integer  n 
)

Definition at line 466 of file lapi.cpp.

References api_incr_top, lua_lock, lua_unlock, setivalue, and lua_State::top.

Referenced by aux_lines(), byteoffset(), ai::cfun_ai_get_recruitment_pattern(), ai::cfun_ai_get_targets(), cfun_exec_candidate_action(), codepoint(), lua_pathfind_cost_calculator::cost(), db_gethook(), f_seek(), ai::unit_advancements_aspect::get_advancements(), get_new_thread(), lua_callable::get_value(), hookf(), ai::impl_ai_aspect_get(), ai::impl_ai_get(), impl_music_get(), impl_music_len(), impl_unit_attacks_len(), impl_unit_get(), lua_common::impl_vconfig_ipairs(), lua_common::impl_vconfig_ipairs_iter(), lua_common::impl_vconfig_size(), intf_default_generate_height_map(), lua_map_location::intf_distance_between(), game_lua_kernel::intf_find_cost_map(), game_lua_kernel::intf_find_path(), intf_find_path(), game_lua_kernel::intf_find_reach(), game_lua_kernel::intf_find_vacant_tile(), lua_gui2::intf_get_dialog_value(), intf_get_image_size(), lua_map_location::intf_get_in_basis_N_NE(), game_lua_kernel::intf_get_locations(), game_lua_kernel::intf_get_map_size(), game_lua_kernel::intf_get_mouseover_tile(), game_lua_kernel::intf_get_selected_tile(), game_lua_kernel::intf_get_terrain_info(), game_lua_kernel::intf_get_time_of_day(), intf_get_time_stamp(), intf_get_viewing_side(), game_lua_kernel::intf_get_village_owner(), game_lua_kernel::intf_get_villages(), intf_unit_defense(), intf_unit_jamming_cost(), intf_unit_movement_cost(), intf_unit_resistance(), intf_unit_vision_cost(), ipairsaux(), iter_aux(), iter_codes(), luaB_collectgarbage(), luaB_ipairs(), luaB_rawlen(), luaB_select(), luaB_tonumber(), luaL_execresult(), luaL_fileresult(), luaL_unref(), luaopen_math(), luaW_push_locationset(), luaW_pushfaivariant(), luaW_pushlocation(), luaW_pushtstring(), math_abs(), math_fmod(), math_random(), math_toint(), math_type(), pack(), pairsmeta(), ai::push_attack_analysis(), ai::push_move_map(), push_onecapture(), pushnumint(), game_lua_kernel::run_filter(), setfield(), settabsi(), lua_gui2::show_dialog(), lua_gui2::show_menu(), lua_gui2::show_message_dialog(), str_byte(), str_find_aux(), str_gsub(), str_len(), str_packsize(), str_unpack(), ai::lua_object< T >::to_type(), ai::transform_ai_action(), and utflen().

◆ lua_pushlightuserdata()

LUA_API void lua_pushlightuserdata ( lua_State L,
void *  p 
)

◆ lua_pushlstring()

LUA_API const char* lua_pushlstring ( lua_State L,
const char *  s,
size_t  len 
)

◆ lua_pushnil()

LUA_API void lua_pushnil ( lua_State L)

◆ lua_pushnumber()

LUA_API void lua_pushnumber ( lua_State L,
lua_Number  n 
)

◆ lua_pushstring()

LUA_API const char* lua_pushstring ( lua_State L,
const char *  s 
)

Definition at line 491 of file lapi.cpp.

References api_incr_top, getstr, lua_lock, lua_unlock, luaC_checkGC, luaS_new(), s, setnilvalue, setsvalue2s, and lua_State::top.

Referenced by auxupvalue(), ai::cfun_ai_get_grouping(), ai::cfun_ai_get_recruitment_pattern(), ai::cfun_ai_get_targets(), game_lua_kernel::cfun_builtin_effect(), checkfield(), checkload(), db_gethook(), db_getlocal(), db_sethook(), db_setlocal(), findloader(), game_lua_kernel::game_lua_kernel(), hookf(), ai::impl_ai_aspect_set(), ai::impl_ai_get(), impl_name_generator_call(), impl_race_get(), lua_rng::impl_rng_destroy(), impl_side_get(), lua_common::impl_tstring_tostring(), impl_unit_get(), impl_unit_type_new(), impl_unit_type_next(), lua_common::impl_vconfig_get(), game_lua_kernel::initialize(), lua_cpp::intf_cleanup(), game_lua_kernel::intf_create_animator(), intf_debug_ai(), intf_describe_plugins(), lua_map_location::intf_distance_between(), game_lua_kernel::intf_find_cost_map(), game_lua_kernel::intf_find_path(), game_lua_kernel::intf_find_reach(), lua_gui2::intf_get_dialog_value(), lua_map_location::intf_get_relative_dir(), game_lua_kernel::intf_get_terrain(), intf_get_terrain(), game_lua_kernel::intf_get_terrain_info(), game_lua_kernel::intf_get_time_of_day(), intf_get_traits(), intf_name_generator(), lua_gui2::intf_remove_dialog_item(), lua_kernel_base::intf_require(), lua_map_location::intf_rotate_right_around_center(), lua_gui2::intf_set_dialog_callback(), lua_map_location::intf_tiles_adjacent(), lua_cpp::intf_tostring(), lua_map_location::intf_vector_diff(), lua_map_location::intf_vector_sum(), intf_wml_tostring(), ll_loadlib(), ll_require(), lua_kernel_base::load_core(), game_lua_kernel::load_game(), lua_kernel_base::load_package(), application_lua_kernel::load_script_from_file(), ai::lua_ai_load::lua_ai_load(), lua_kernel_base::lua_kernel_base(), luaB_type(), luaL_execresult(), luaL_fileresult(), luaL_getmetafield(), luaL_newmetatable(), luaL_requiref(), luaL_tolstring(), luaW_filltable(), luaW_pushfaivariant(), luaW_pushrace(), luaW_pushsimweapon(), luaW_pushtstring(), luaW_tableget(), os_getenv(), os_setlocale(), os_tmpname(), ai::push_attack_analysis(), game_lua_kernel::push_builtin_effect(), push_component(), push_locations_table(), ai::push_movements(), pushglobalfuncname(), lua_units::register_attacks_metatables(), lua_common::register_gettext_metatable(), lua_race::register_metatable(), lua_unit_type::register_metatable(), lua_team::register_metatable(), lua_formula_bridge::register_metatables(), lua_terrainmap::register_metatables(), lua_units::register_metatables(), lua_terrainfilter::register_metatables(), lua_preferences::register_table(), lua_unit_type::register_table(), lua_audio::register_table(), lua_common::register_tstring_metatable(), lua_common::register_vconfig_metatable(), game_lua_kernel::run_event(), application_lua_kernel::thread::run_script(), searcher_Croot(), game_lua_kernel::set_wml_action(), game_lua_kernel::set_wml_condition(), setpath(), settabss(), special_locations_newindex(), special_locations_next(), ai::lua_object< T >::to_type(), ai::transform_ai_action(), and ai::lua_ai_load::~lua_ai_load().

◆ lua_pushthread()

LUA_API int lua_pushthread ( lua_State L)

Definition at line 573 of file lapi.cpp.

References api_incr_top, G, lua_lock, lua_unlock, setthvalue, and lua_State::top.

Referenced by db_gethook(), db_sethook(), hookf(), and luaB_corunning().

◆ lua_pushvalue()

LUA_API void lua_pushvalue ( lua_State L,
int  idx 
)

Definition at line 237 of file lapi.cpp.

References api_incr_top, index2addr(), lua_lock, lua_unlock, setobj2s, and lua_State::top.

Referenced by add_value(), addtoclib(), game_lua_kernel::apply_effect(), auxsort(), lua_pathfind_cost_calculator::cost(), ai::lua_ai_context::create(), ai::lua_ai_action_handler::create(), createmeta(), createmetatable(), createsearcherstable(), createstdfile(), db_getinfo(), db_getlocal(), db_getregistry(), db_sethook(), db_traceback(), f_write(), lua_mapgen::filter::filter(), finishpcall(), g_iofile(), ai::generate_and_push_ai_state(), generic_reader(), lua_kernel_base::get_attribute_names(), lua_callable::get_inputs(), get_new_thread(), ai::impl_ai_get(), game_lua_kernel::impl_theme_items_get(), game_lua_kernel::impl_theme_items_set(), impl_unit_attacks_iter(), impl_unit_attacks_next(), impl_unit_get(), impl_unit_type_pairs(), lua_common::impl_vconfig_ipairs(), lua_common::impl_vconfig_pairs(), intf_describe_plugins(), intf_do_unsynced(), intf_load(), lua_kernel_base::intf_print(), lua_kernel_base::intf_require(), lua_gui2::intf_set_dialog_callback(), game_lua_kernel::intf_skip_messages(), io_readline(), iter_codes(), ll_require(), load_aux(), lua_rng::load_tables(), luaB_cocreate(), luaB_error(), luaB_ipairs(), luaB_print(), luaB_xpcall(), luaL_callmeta(), luaL_getsubtable(), luaL_newmetatable(), luaL_requiref(), luaL_setfuncs(), luaL_tolstring(), luaopen_base(), luaopen_package(), luaW_pushslocs(), luaW_to_locationset(), math_max(), math_min(), pairsmeta(), game_lua_kernel::push_builtin_effect(), push_unit_attacks_table(), lua_cpp::register_metatable(), lua_preferences::register_table(), game_lua_kernel::run_filter(), lua_cpp::set_functions(), lua_gui2::show_dialog(), sort_comp(), special_locations_pairs(), and tmove().

◆ lua_pushvfstring()

LUA_API const char* lua_pushvfstring ( lua_State L,
const char *  fmt,
va_list  argp 
)

Definition at line 508 of file lapi.cpp.

References lua_lock, lua_unlock, luaC_checkGC, and luaO_pushvfstring().

Referenced by luaL_error().

◆ lua_rawequal()

LUA_API int lua_rawequal ( lua_State L,
int  index1,
int  index2 
)

Definition at line 295 of file lapi.cpp.

References index2addr(), isvalid, and luaV_rawequalobj.

Referenced by findfield(), luaB_rawequal(), and luaL_testudata().

◆ lua_rawget()

LUA_API int lua_rawget ( lua_State L,
int  idx 
)

◆ lua_rawgeti()

LUA_API int lua_rawgeti ( lua_State L,
int  idx,
lua_Integer  n 
)

◆ lua_rawgetp()

LUA_API int lua_rawgetp ( lua_State L,
int  idx,
const void *  p 
)

◆ lua_rawlen()

LUA_API size_t lua_rawlen ( lua_State L,
int  idx 
)

◆ lua_rawset()

LUA_API void lua_rawset ( lua_State L,
int  idx 
)

◆ lua_rawseti()

LUA_API void lua_rawseti ( lua_State L,
int  idx,
lua_Integer  n 
)

◆ lua_rawsetp()

LUA_API void lua_rawsetp ( lua_State L,
int  idx,
const void *  p 
)

◆ lua_rotate()

LUA_API void lua_rotate ( lua_State L,
int  idx,
int  n 
)

◆ lua_setallocf()

LUA_API void lua_setallocf ( lua_State L,
lua_Alloc  f,
void *  ud 
)

Definition at line 1176 of file lapi.cpp.

References f, G, lua_lock, and lua_unlock.

◆ lua_setfield()

LUA_API void lua_setfield ( lua_State L,
int  idx,
const char *  k 
)

Definition at line 777 of file lapi.cpp.

References auxsetstr(), index2addr(), and lua_lock.

Referenced by addtoclib(), application_lua_kernel::application_lua_kernel(), ai::lua_ai_context::create(), createclibstable(), createmeta(), createmetatable(), createsearcherstable(), createstdfile(), db_sethook(), g_iofile(), game_lua_kernel::game_lua_kernel(), ai::generate_and_push_ai_state(), ai::generate_and_push_ai_table(), ai::impl_ai_aspect_get(), ai::impl_ai_get(), lua_common::impl_vconfig_get(), ai::lua_ai_context::init(), game_lua_kernel::initialize(), game_lua_kernel::intf_create_animator(), game_lua_kernel::intf_get_terrain_info(), game_lua_kernel::intf_get_time_of_day(), lua_fileops::intf_read_file(), ll_require(), lua_rng::load_tables(), lua_kernel_base::lua_kernel_base(), luaL_getsubtable(), luaL_newmetatable(), luaL_requiref(), luaL_setfuncs(), luaL_tolstring(), luaopen_base(), luaopen_math(), luaopen_package(), luaopen_utf8(), luaW_filltable(), luaW_pushrace(), luaW_pushracetable(), luaW_pushsimdata(), luaW_pushsimweapon(), mapgen_lua_kernel::mapgen_lua_kernel(), newbox(), pack(), push_error_handler(), lua_units::register_attacks_metatables(), lua_common::register_gettext_metatable(), lua_cpp::register_metatable(), lua_race::register_metatable(), lua_unit_type::register_metatable(), lua_team::register_metatable(), lua_formula_bridge::register_metatables(), lua_terrainmap::register_metatables(), lua_units::register_metatables(), lua_terrainfilter::register_metatables(), lua_preferences::register_table(), lua_unit_type::register_table(), lua_audio::register_table(), lua_common::register_tstring_metatable(), lua_common::register_vconfig_metatable(), ai::lua_ai_context::set_arguments(), lua_cpp::set_functions(), ai::lua_ai_context::set_persistent_data(), setboolfield(), setfield(), setpath(), settabsb(), settabsi(), settabss(), ai::transform_ai_action(), treatstackoption(), and ai::lua_ai_context::update_state().

◆ lua_setglobal()

LUA_API void lua_setglobal ( lua_State L,
const char *  name 
)

◆ lua_seti()

LUA_API void lua_seti ( lua_State L,
int  idx,
lua_Integer  n 
)

◆ lua_setmetatable()

LUA_API int lua_setmetatable ( lua_State L,
int  objindex 
)

◆ lua_settable()

LUA_API void lua_settable ( lua_State L,
int  idx 
)

◆ lua_settop()

LUA_API void lua_settop ( lua_State L,
int  idx 
)

◆ lua_setupvalue()

LUA_API const char* lua_setupvalue ( lua_State L,
int  funcindex,
int  n 
)

◆ lua_setuservalue()

LUA_API void lua_setuservalue ( lua_State L,
int  idx 
)

◆ lua_status()

LUA_API int lua_status ( lua_State L)

◆ lua_stringtonumber()

LUA_API size_t lua_stringtonumber ( lua_State L,
const char *  s 
)

Definition at line 337 of file lapi.cpp.

References api_incr_top, luaO_str2num(), and lua_State::top.

Referenced by luaB_tonumber(), and read_number().

◆ lua_toboolean()

LUA_API int lua_toboolean ( lua_State L,
int  idx 
)

◆ lua_tocfunction()

LUA_API lua_CFunction lua_tocfunction ( lua_State L,
int  idx 
)

Definition at line 404 of file lapi.cpp.

References clCvalue, fvalue, index2addr(), ttisCclosure, and ttislcf.

◆ lua_tointegerx()

LUA_API lua_Integer lua_tointegerx ( lua_State L,
int  idx,
int *  pisnum 
)

◆ lua_tolstring()

LUA_API const char* lua_tolstring ( lua_State L,
int  idx,
size_t *  len 
)

◆ lua_tonumberx()

LUA_API lua_Number lua_tonumberx ( lua_State L,
int  idx,
int *  pisnum 
)

◆ lua_topointer()

LUA_API const void* lua_topointer ( lua_State L,
int  idx 
)

◆ lua_tothread()

LUA_API lua_State* lua_tothread ( lua_State L,
int  idx 
)

Definition at line 423 of file lapi.cpp.

References index2addr(), thvalue, and ttisthread.

Referenced by getco(), getthread(), and luaB_auxwrap().

◆ lua_touserdata()

LUA_API void* lua_touserdata ( lua_State L,
int  idx 
)

◆ lua_type()

LUA_API int lua_type ( lua_State L,
int  idx 
)

◆ lua_typename()

LUA_API const char* lua_typename ( lua_State L,
int  t 
)

◆ lua_upvalueid()

LUA_API void* lua_upvalueid ( lua_State L,
int  fidx,
int  n 
)

Definition at line 1268 of file lapi.cpp.

References api_check, clCvalue, f, getupvalref(), index2addr(), LUA_TCCL, LUA_TLCL, ttype, and CClosure::upvalue.

Referenced by db_upvalueid().

◆ lua_upvaluejoin()

LUA_API void lua_upvaluejoin ( lua_State L,
int  fidx1,
int  n1,
int  fidx2,
int  n2 
)

Definition at line 1287 of file lapi.cpp.

References getupvalref(), luaC_upvalbarrier, luaC_upvdeccount(), UpVal::refcount, and upisopen.

Referenced by db_upvaluejoin().

◆ lua_version()

LUA_API const lua_Number* lua_version ( lua_State L)

Definition at line 144 of file lapi.cpp.

References G, and LUA_VERSION_NUM.

Referenced by f_luaopen(), and luaL_checkversion_().

◆ lua_xmove()

LUA_API void lua_xmove ( lua_State from,
lua_State to,
int  n 
)

◆ reverse()

static void reverse ( lua_State L,
StkId  from,
StkId  to 
)
static

Variable Documentation

◆ lua_ident

const char lua_ident[]
Initial value:
=
"$LuaVersion: " LUA_COPYRIGHT " $"
"$LuaAuthors: " LUA_AUTHORS " $"
#define LUA_COPYRIGHT
Definition: lua.h:26
#define LUA_AUTHORS
Definition: lua.h:27

Definition at line 34 of file lapi.cpp.