The Battle for Wesnoth  1.15.11+dev
Classes | Macros | Functions | Variables
lapi.cpp File Reference
#include "lprefix.h"
#include <limits.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 isvalid(L, o)   (!ttisnil(o) || o != &G(L)->nilvalue)
 
#define ispseudo(i)   ((i) <= LUA_REGISTRYINDEX)
 
#define isupvalue(i)   ((i) < LUA_REGISTRYINDEX)
 
#define checkresults(L, na, nr)
 

Functions

static TValueindex2value (lua_State *L, int idx)
 
static StkId index2stack (lua_State *L, int idx)
 
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 lua_Number lua_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 lua_Unsigned lua_rawlen (lua_State *L, int idx)
 
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx)
 
static void * touserdata (const TValue *o)
 
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)
 
static int finishrawget (lua_State *L, const TValue *val)
 
static Tablegettable (lua_State *L, int idx)
 
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_getiuservalue (lua_State *L, int idx, int n)
 
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)
 
static void aux_rawset (lua_State *L, int idx, TValue *key, int n)
 
LUA_API void lua_rawset (lua_State *L, int idx)
 
LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p)
 
LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n)
 
LUA_API int lua_setmetatable (lua_State *L, int objindex)
 
LUA_API int lua_setiuservalue (lua_State *L, int idx, int n)
 
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,...)
 
LUA_API int lua_error (lua_State *L)
 
LUA_API int lua_next (lua_State *L, int idx)
 
LUA_API void lua_toclose (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)
 
void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud)
 
void lua_warning (lua_State *L, const char *msg, int tocont)
 
LUA_API void * lua_newuserdatauv (lua_State *L, size_t size, int nuvalue)
 
static const char * aux_upvalue (TValue *fi, int n, TValue **val, GCObject **owner)
 
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

◆ 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:36
#define api_check(l, e, msg)
Definition: llimits.h:113

Definition at line 966 of file lapi.cpp.

Referenced by lua_callk(), and lua_pcallk().

◆ ispseudo

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

Definition at line 50 of file lapi.cpp.

Referenced by index2stack(), index2value(), and lua_absindex().

◆ isupvalue

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

Definition at line 53 of file lapi.cpp.

Referenced by lua_copy().

◆ isvalid

#define isvalid (   L,
 
)    (!ttisnil(o) || o != &G(L)->nilvalue)

Definition at line 46 of file lapi.cpp.

Referenced by lua_compare(), lua_copy(), 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.

Function Documentation

◆ aux_rawset()

static void aux_rawset ( lua_State L,
int  idx,
TValue key,
int  n 
)
static

◆ aux_upvalue()

static const char* aux_upvalue ( TValue fi,
int  n,
TValue **  val,
GCObject **  owner 
)
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 1003 of file lapi.cpp.

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

Referenced by lua_pcallk().

◆ finishrawget()

static int finishrawget ( lua_State L,
const TValue val 
)
static

Definition at line 680 of file lapi.cpp.

References api_incr_top, isempty, lua_unlock, s2v, setnilvalue, setobj2s, lua_State::top, and ttype.

Referenced by lua_rawget(), lua_rawgeti(), and lua_rawgetp().

◆ gettable()

static Table* gettable ( lua_State L,
int  idx 
)
static

Definition at line 691 of file lapi.cpp.

References api_check, hvalue, index2value(), t, and ttistable.

Referenced by aux_rawset(), lua_next(), lua_rawget(), lua_rawgeti(), lua_rawgetp(), and lua_rawseti().

◆ getupvalref()

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

Definition at line 1385 of file lapi.cpp.

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

Referenced by lua_upvalueid(), and lua_upvaluejoin().

◆ index2stack()

static StkId index2stack ( lua_State L,
int  idx 
)
static

Definition at line 83 of file lapi.cpp.

References api_check, lua_State::ci, CallInfo::func, ispseudo, and lua_State::top.

Referenced by lua_pcallk(), lua_rotate(), and lua_toclose().

◆ index2value()

static TValue* index2value ( 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 
)

Definition at line 311 of file lapi.cpp.

References api_checknelems, api_incr_top, lua_lock, LUA_OPBNOT, LUA_OPUNM, lua_unlock, luaO_arith(), s2v, setobjs2s, and lua_State::top.

Referenced by arith().

◆ lua_atpanic()

LUA_API lua_CFunction lua_atpanic ( lua_State L,
lua_CFunction  panicf 
)

Definition at line 136 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 1078 of file lapi.cpp.

References api_checknelems, getproto, isLfunction, lua_lock, lua_unlock, luaU_dump(), s2v, 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,
  ... 
)

◆ lua_getallocf()

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

Definition at line 1277 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_getiuservalue()

LUA_API int lua_getiuservalue ( lua_State L,
int  idx,
int  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)

◆ lua_getupvalue()

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

Definition at line 1352 of file lapi.cpp.

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

Referenced by auxupvalue().

◆ lua_iscfunction()

LUA_API int lua_iscfunction ( lua_State L,
int  idx 
)

Definition at line 273 of file lapi.cpp.

References index2value(), ttisCclosure, and ttislcf.

Referenced by db_upvaluejoin().

◆ 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_newuserdatauv()

LUA_API void* lua_newuserdatauv ( lua_State L,
size_t  size,
int  nuvalue 
)

◆ 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 581 of file lapi.cpp.

References api_incr_top, lua_lock, lua_unlock, s2v, setbfvalue, setbtvalue, and lua_State::top.

Referenced by aux_lines(), ai::cfun_ai_get_leader_goal(), 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(), db_getuservalue(), finishpcall(), ai::lua_object< T >::from_type(), impl_color_equality(), game_lua_kernel::impl_get_terrain_info(), 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(), game_lua_kernel::intf_get_fog_or_shroud(), 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(), intf_on_board(), intf_on_border(), lua_map_location::intf_tiles_adjacent(), game_lua_kernel::intf_unit_ability(), game_lua_kernel::intf_view_locked(), lua_wml::intf_wml_equal(), lua_wml::intf_wml_matches_filter(), lua_wml::intf_wml_valid(), ll_require(), lookforfunc(), ai::lua_ai_load::lua_ai_load(), lua_check_impl::lua_push(), luaB_close(), luaB_collectgarbage(), luaB_coresume(), luaB_corunning(), luaB_pcall(), luaB_rawequal(), luaB_xpcall(), luaB_yieldable(), luaL_execresult(), luaL_fileresult(), luaL_setfuncs(), 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 489 of file lapi.cpp.

References api_incr_top, lua_lock, lua_unlock, s2v, 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(), db_setcstacklimit(), f_seek(), ai::unit_advancements_aspect::get_advancements(), get_new_thread(), get_onecapture(), lua_callable::get_value(), hookf(), ai::impl_ai_aspect_get(), ai::impl_ai_get(), game_lua_kernel::impl_get_terrain_info(), impl_music_get(), impl_music_len(), impl_terrainmap_iter(), impl_unit_attacks_len(), lua_common::impl_vconfig_ipairs(), lua_common::impl_vconfig_ipairs_iter(), lua_common::impl_vconfig_size(), impl_warn(), 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(), intf_get_image_size(), lua_map_location::intf_get_in_basis_N_NE(), game_lua_kernel::intf_get_locations(), game_lua_kernel::intf_get_max_liminal_bonus(), game_lua_kernel::intf_get_mouseover_tile(), game_lua_kernel::intf_get_selected_tile(), 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_replace_if_failed(), intf_show_dialog(), intf_unit_defense(), intf_unit_jamming_cost(), intf_unit_movement_cost(), intf_unit_resistance(), intf_unit_vision_cost(), ipairsaux(), iter_aux(), iter_codes(), lua_check_impl::lua_push(), 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(), ai::push_attack_analysis(), ai::push_move_map(), pushnumint(), game_lua_kernel::run_filter(), setfield(), setrandfunc(), setseed(), settabsi(), 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(), tpack(), 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 514 of file lapi.cpp.

References api_incr_top, getstr, lua_lock, lua_unlock, luaC_checkGC, luaS_new(), s, s2v, 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(), game_lua_kernel::impl_get_terrain_info(), impl_name_generator_call(), lua_rng::impl_rng_destroy(), impl_side_get(), impl_slocs_next(), lua_common::impl_tstring_tostring(), impl_unit_type_new(), impl_unit_type_next(), lua_common::impl_vconfig_get(), 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_map_location::intf_get_relative_dir(), game_lua_kernel::intf_get_time_of_day(), intf_get_traits(), intf_name_generator(), lua_kernel_base::intf_require(), lua_map_location::intf_rotate_right_around_center(), lua_map_location::intf_tiles_adjacent(), lua_cpp::intf_tostring(), lua_map_location::intf_vector_diff(), lua_map_location::intf_vector_sum(), lua_wml::intf_wml_tostring(), ll_loadlib(), 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_costatus(), luaB_type(), luaL_execresult(), luaL_fileresult(), luaL_getmetafield(), luaL_newmetatable(), luaL_requiref(), luaL_tolstring(), luaW_checkrace(), luaW_filltable(), lua_gui2::luaW_open(), luaW_push_terrain(), luaW_pushfaivariant(), luaW_pushrace(), luaW_pushsimweapon(), luaW_pushtstring(), luaW_tableget(), math_type(), os_getenv(), os_setlocale(), os_tmpname(), ai::push_attack_analysis(), game_lua_kernel::push_builtin_effect(), push_component(), ai::push_movements(), pushglobalfuncname(), pushmode(), lua_units::register_attacks_metatables(), lua_common::register_gettext_metatable(), lua_cpp::register_metatable(), lua_race::register_metatable(), lua_widget::register_metatable(), lua_unit_type::register_metatable(), lua_formula_bridge::register_metatables(), lua_colors::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(), searchpath(), game_lua_kernel::set_wml_action(), game_lua_kernel::set_wml_condition(), setpath(), settabss(), 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 600 of file lapi.cpp.

References api_incr_top, G, lua_lock, lua_unlock, s2v, 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 246 of file lapi.cpp.

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

Referenced by add_value(), addtoclib(), game_lua_kernel::apply_effect(), aux_lines(), auxsort(), lua_pathfind_cost_calculator::cost(), ai::lua_ai_context::create(), ai::lua_ai_action_handler::create(), 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(), impl_side_get(), impl_slocs_iter(), lua_stringx::impl_str_index(), game_lua_kernel::impl_theme_items_get(), game_lua_kernel::impl_theme_items_set(), impl_unit_attacks_iter(), impl_unit_attacks_next(), impl_unit_type_pairs(), lua_common::impl_vconfig_ipairs(), lua_common::impl_vconfig_pairs(), lua_kernel_base::interactive_run(), intf_describe_plugins(), intf_do_unsynced(), intf_load(), lua_kernel_base::intf_print(), intf_replace_if_failed(), lua_kernel_base::intf_require(), intf_set_dialog_callback(), intf_show_dialog(), game_lua_kernel::intf_skip_messages(), lua_stringx::intf_str_format(), lua_stringx::intf_str_join_map(), io_lines(), io_readline(), iter_codes(), ll_require(), load_aux(), lua_rng::load_tables(), luaB_cocreate(), luaB_error(), luaB_ipairs(), luaB_pairs(), luaB_xpcall(), luaL_callmeta(), luaL_getsubtable(), luaL_newmetatable(), luaL_requiref(), luaL_setfuncs(), luaL_tolstring(), luaopen_base(), luaopen_package(), luaW_pushwidgettable(), luaW_pushwidgettablecontainer(), luaW_pushwindowtable(), luaW_to_locationset(), math_max(), math_min(), 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(), sort_comp(), str_gsub(), tmove(), tonum(), WIDGET_GETTER(), and WIDGET_SETTER().

◆ lua_pushvfstring()

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

Definition at line 531 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 304 of file lapi.cpp.

References index2value(), 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 
)

Definition at line 718 of file lapi.cpp.

References cast_voidp, finishrawget(), gettable(), lua_lock, luaH_get(), setpvalue, and t.

◆ lua_rawlen()

LUA_API lua_Unsigned 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 
)

Definition at line 882 of file lapi.cpp.

References aux_rawset(), cast_voidp, and setpvalue.

◆ 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 1287 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 837 of file lapi.cpp.

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

Referenced by addtoclib(), application_lua_kernel::application_lua_kernel(), ai::lua_ai_context::create(), createclibstable(), createmeta(), createmetatable(), createsearcherstable(), createstdfile(), db_getinfo(), 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(), game_lua_kernel::impl_get_terrain_info(), lua_common::impl_vconfig_get(), ai::lua_ai_context::init(), game_lua_kernel::initialize(), lua_kernel_base::interactive_run(), game_lua_kernel::intf_create_animator(), 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(), luaopen_base(), luaopen_math(), luaopen_package(), luaopen_utf8(), luaW_filltable(), lua_stringx::luaW_open(), luaW_pushrace(), luaW_pushracetable(), luaW_pushsimdata(), luaW_pushsimweapon(), mapgen_lua_kernel::mapgen_lua_kernel(), push_error_handler(), lua_units::register_attacks_metatables(), lua_common::register_gettext_metatable(), lua_cpp::register_metatable(), lua_race::register_metatable(), lua_widget::register_metatable(), lua_unit_type::register_metatable(), lua_formula_bridge::register_metatables(), lua_colors::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(), tpack(), 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_setiuservalue()

LUA_API int lua_setiuservalue ( lua_State L,
int  idx,
int  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 
)

Definition at line 173 of file lapi.cpp.

References api_check, lua_State::ci, CallInfo::func, hastocloseCfunc, lua_lock, LUA_OK, lua_unlock, luaF_close(), CallInfo::nresults, s2v, setnilvalue, and lua_State::top.

Referenced by application_lua_kernel::application_lua_kernel(), game_lua_kernel::apply_effect(), ai::cfun_attack_rating(), db_debug(), db_sethook(), db_setlocal(), db_setmetatable(), db_setuservalue(), lua_callable::do_compare(), game_lua_kernel::game_lua_kernel(), 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(), gmatch(), ai::lua_ai_action_handler::handle(), impl_slocs_iter(), game_lua_kernel::initialize(), lua_kernel_base::interactive_run(), game_lua_kernel::intf_get_recall_units(), game_lua_kernel::intf_get_sides(), game_lua_kernel::intf_get_units(), lua_stringx::intf_str_join_map(), intf_terrainmap_iter(), io_readline(), ll_require(), lua_kernel_base::load_core(), load_fake_units(), lua_kernel_base::lua_kernel_base(), luaB_assert(), luaB_dofile(), luaB_error(), luaB_load(), luaB_next(), luaB_rawget(), luaB_rawset(), luaB_setmetatable(), luaB_tonumber(), luaL_loadfilex(), luaW_toconfig(), mapgen_lua_kernel::mapgen_lua_kernel(), math_ceil(), math_floor(), math_modf(), os_time(), pushglobalfuncname(), ai::lua_ai_context::set_arguments(), ai::lua_ai_context::set_persistent_data(), sort(), str_dump(), ai::lua_object< T >::to_type(), trymt(), and ai::unit_advancements_aspect::unit_advancements_aspect().

◆ lua_setupvalue()

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

◆ lua_setwarnf()

void lua_setwarnf ( lua_State L,
lua_WarnFunction  f,
void *  ud 
)

Definition at line 1295 of file lapi.cpp.

References f, G, lua_lock, and lua_unlock.

Referenced by checkcontrol(), lua_kernel_base::lua_kernel_base(), luaL_newstate(), and warnfcont().

◆ 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 347 of file lapi.cpp.

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

Referenced by luaB_tonumber(), read_number(), and tonum().

◆ 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 414 of file lapi.cpp.

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

◆ lua_toclose()

LUA_API void lua_toclose ( lua_State L,
int  idx 
)

◆ 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 438 of file lapi.cpp.

References index2value(), 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 1399 of file lapi.cpp.

References api_check, clCvalue, f, getupvalref(), index2value(), LUA_VCCL, LUA_VLCF, LUA_VLCL, ttypetag, and CClosure::upvalue.

Referenced by checkupval().

◆ lua_upvaluejoin()

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

Definition at line 1421 of file lapi.cpp.

References api_check, getupvalref(), and luaC_objbarrier.

Referenced by db_upvaluejoin().

◆ lua_version()

LUA_API lua_Number lua_version ( lua_State L)

Definition at line 146 of file lapi.cpp.

References LUA_VERSION_NUM, and UNUSED.

Referenced by luaL_checkversion_().

◆ lua_warning()

void lua_warning ( lua_State L,
const char *  msg,
int  tocont 
)

Definition at line 1303 of file lapi.cpp.

References lua_lock, lua_unlock, and luaE_warning().

Referenced by intf_deprecated_message(), and luaB_warn().

◆ 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

◆ touserdata()

static void* touserdata ( const TValue o)
static

Definition at line 423 of file lapi.cpp.

References getudatamem, LUA_TLIGHTUSERDATA, LUA_TUSERDATA, pvalue, ttype, and uvalue.

Referenced by lua_topointer(), and lua_touserdata().

Variable Documentation

◆ lua_ident

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

Definition at line 35 of file lapi.cpp.