The Battle for Wesnoth  1.17.0-dev
Macros | Functions | Variables
lbaselib.cpp File Reference
#include "lprefix.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Include dependency graph for lbaselib.cpp:

Go to the source code of this file.

Macros

#define lbaselib_c
 
#define LUA_LIB
 
#define SPACECHARS   " \f\n\r\t\v"
 
#define RESERVEDSLOT   5
 

Functions

static int luaB_print (lua_State *L)
 
static int luaB_warn (lua_State *L)
 
static const char * b_str2int (const char *s, int base, lua_Integer *pn)
 
static int luaB_tonumber (lua_State *L)
 
static int luaB_error (lua_State *L)
 
static int luaB_getmetatable (lua_State *L)
 
static int luaB_setmetatable (lua_State *L)
 
static int luaB_rawequal (lua_State *L)
 
static int luaB_rawlen (lua_State *L)
 
static int luaB_rawget (lua_State *L)
 
static int luaB_rawset (lua_State *L)
 
static int pushmode (lua_State *L, int oldmode)
 
static int luaB_collectgarbage (lua_State *L)
 
static int luaB_type (lua_State *L)
 
static int luaB_next (lua_State *L)
 
static int luaB_pairs (lua_State *L)
 
static int ipairsaux (lua_State *L)
 
static int luaB_ipairs (lua_State *L)
 
static int load_aux (lua_State *L, int status, int envidx)
 
static int luaB_loadfile (lua_State *L)
 
static const char * generic_reader (lua_State *L, void *ud, size_t *size)
 
static int luaB_load (lua_State *L)
 
static int dofilecont (lua_State *L, int d1, lua_KContext d2)
 
static int luaB_dofile (lua_State *L)
 
static int luaB_assert (lua_State *L)
 
static int luaB_select (lua_State *L)
 
static int finishpcall (lua_State *L, int status, lua_KContext extra)
 
static int luaB_pcall (lua_State *L)
 
static int luaB_xpcall (lua_State *L)
 
static int luaB_tostring (lua_State *L)
 
LUAMOD_API int luaopen_base (lua_State *L)
 

Variables

static const luaL_Reg base_funcs []
 

Macro Definition Documentation

◆ lbaselib_c

#define lbaselib_c

Definition at line 7 of file lbaselib.cpp.

◆ LUA_LIB

#define LUA_LIB

Definition at line 8 of file lbaselib.cpp.

◆ RESERVEDSLOT

#define RESERVEDSLOT   5

Definition at line 339 of file lbaselib.cpp.

Referenced by generic_reader(), and luaB_load().

◆ SPACECHARS

#define SPACECHARS   " \f\n\r\t\v"

Definition at line 58 of file lbaselib.cpp.

Referenced by b_str2int().

Function Documentation

◆ b_str2int()

static const char* b_str2int ( const char *  s,
int  base,
lua_Integer pn 
)
static

Definition at line 60 of file lbaselib.cpp.

References digit(), n, s, and SPACECHARS.

Referenced by luaB_tonumber().

◆ dofilecont()

static int dofilecont ( lua_State L,
int  d1,
lua_KContext  d2 
)
static

Definition at line 387 of file lbaselib.cpp.

References lua_gettop().

Referenced by luaB_dofile().

◆ finishpcall()

static int finishpcall ( lua_State L,
int  status,
lua_KContext  extra 
)
static

Definition at line 439 of file lbaselib.cpp.

References lua_gettop(), LUA_OK, lua_pushboolean(), lua_pushvalue(), and LUA_YIELD.

Referenced by luaB_pcall(), and luaB_xpcall().

◆ generic_reader()

static const char* generic_reader ( lua_State L,
void *  ud,
size_t *  size 
)
static

◆ ipairsaux()

static int ipairsaux ( lua_State L)
static

Definition at line 281 of file lbaselib.cpp.

References i, lua_geti(), lua_pushinteger(), LUA_TNIL, and luaL_checkinteger().

Referenced by luaB_ipairs().

◆ load_aux()

static int load_aux ( lua_State L,
int  status,
int  envidx 
)
static

Definition at line 301 of file lbaselib.cpp.

References lua_insert, LUA_OK, lua_pop, lua_pushvalue(), lua_setupvalue(), and luaL_pushfail.

Referenced by luaB_load(), and luaB_loadfile().

◆ luaB_assert()

static int luaB_assert ( lua_State L)
static

◆ luaB_collectgarbage()

static int luaB_collectgarbage ( lua_State L)
static

◆ luaB_dofile()

static int luaB_dofile ( lua_State L)
static

◆ luaB_error()

static int luaB_error ( lua_State L)
static

◆ luaB_getmetatable()

static int luaB_getmetatable ( lua_State L)
static

Definition at line 126 of file lbaselib.cpp.

References lua_getmetatable(), lua_pushnil(), luaL_checkany(), and luaL_getmetafield().

◆ luaB_ipairs()

static int luaB_ipairs ( lua_State L)
static

◆ luaB_load()

static int luaB_load ( lua_State L)
static

◆ luaB_loadfile()

static int luaB_loadfile ( lua_State L)
static

Definition at line 318 of file lbaselib.cpp.

References load_aux(), lua_isnone, luaL_loadfilex(), and luaL_optstring.

◆ luaB_next()

static int luaB_next ( lua_State L)
static

Definition at line 251 of file lbaselib.cpp.

References lua_next(), lua_pushnil(), lua_settop(), LUA_TTABLE, and luaL_checktype().

Referenced by luaB_pairs().

◆ luaB_pairs()

static int luaB_pairs ( lua_State L)
static

◆ luaB_pcall()

static int luaB_pcall ( lua_State L)
static

◆ luaB_print()

static int luaB_print ( lua_State L)
static

Definition at line 24 of file lbaselib.cpp.

References i, lua_gettop(), lua_pop, lua_writeline, lua_writestring, luaL_tolstring(), n, and s.

◆ luaB_rawequal()

static int luaB_rawequal ( lua_State L)
static

Definition at line 149 of file lbaselib.cpp.

References lua_pushboolean(), lua_rawequal(), and luaL_checkany().

◆ luaB_rawget()

static int luaB_rawget ( lua_State L)
static

Definition at line 166 of file lbaselib.cpp.

References lua_rawget(), lua_settop(), LUA_TTABLE, luaL_checkany(), and luaL_checktype().

◆ luaB_rawlen()

static int luaB_rawlen ( lua_State L)
static

◆ luaB_rawset()

static int luaB_rawset ( lua_State L)
static

Definition at line 174 of file lbaselib.cpp.

References lua_rawset(), lua_settop(), LUA_TTABLE, luaL_checkany(), and luaL_checktype().

◆ luaB_select()

static int luaB_select ( lua_State L)
static

◆ luaB_setmetatable()

static int luaB_setmetatable ( lua_State L)
static

◆ luaB_tonumber()

static int luaB_tonumber ( lua_State L)
static

◆ luaB_tostring()

static int luaB_tostring ( lua_State L)
static

Definition at line 477 of file lbaselib.cpp.

References luaL_checkany(), and luaL_tolstring().

◆ luaB_type()

static int luaB_type ( lua_State L)
static

Definition at line 243 of file lbaselib.cpp.

References lua_pushstring(), LUA_TNONE, lua_type(), lua_typename(), luaL_argcheck, and t.

◆ luaB_warn()

static int luaB_warn ( lua_State L)
static

Definition at line 45 of file lbaselib.cpp.

References i, lua_gettop(), lua_tostring, lua_warning(), luaL_checkstring, and n.

◆ luaB_xpcall()

static int luaB_xpcall ( lua_State L)
static

◆ luaopen_base()

LUAMOD_API int luaopen_base ( lua_State L)

◆ pushmode()

static int pushmode ( lua_State L,
int  oldmode 
)
static

Definition at line 184 of file lbaselib.cpp.

References LUA_GCINC, and lua_pushstring().

Referenced by luaB_collectgarbage().

Variable Documentation

◆ base_funcs

const luaL_Reg base_funcs[]
static
Initial value:
= {
{"assert", luaB_assert},
{"collectgarbage", luaB_collectgarbage},
{"dofile", luaB_dofile},
{"error", luaB_error},
{"getmetatable", luaB_getmetatable},
{"ipairs", luaB_ipairs},
{"loadfile", luaB_loadfile},
{"load", luaB_load},
{"next", luaB_next},
{"pairs", luaB_pairs},
{"pcall", luaB_pcall},
{"print", luaB_print},
{"warn", luaB_warn},
{"rawequal", luaB_rawequal},
{"rawlen", luaB_rawlen},
{"rawget", luaB_rawget},
{"rawset", luaB_rawset},
{"select", luaB_select},
{"setmetatable", luaB_setmetatable},
{"tonumber", luaB_tonumber},
{"tostring", luaB_tostring},
{"type", luaB_type},
{"xpcall", luaB_xpcall},
{LUA_GNAME, NULL},
{"_VERSION", NULL},
{NULL, NULL}
}
static int luaB_select(lua_State *L)
Definition: lbaselib.cpp:416
static int luaB_pcall(lua_State *L)
Definition: lbaselib.cpp:450
static int luaB_warn(lua_State *L)
Definition: lbaselib.cpp:45
#define LUA_GNAME
Definition: lauxlib.h:19
static int luaB_next(lua_State *L)
Definition: lbaselib.cpp:251
static int luaB_xpcall(lua_State *L)
Definition: lbaselib.cpp:465
static int luaB_ipairs(lua_State *L)
Definition: lbaselib.cpp:292
static int luaB_print(lua_State *L)
Definition: lbaselib.cpp:24
static int luaB_pairs(lua_State *L)
Definition: lbaselib.cpp:263
static int luaB_dofile(lua_State *L)
Definition: lbaselib.cpp:393
static int luaB_tonumber(lua_State *L)
Definition: lbaselib.cpp:81
static int luaB_load(lua_State *L)
Definition: lbaselib.cpp:365
static int luaB_setmetatable(lua_State *L)
Definition: lbaselib.cpp:137
static int luaB_rawequal(lua_State *L)
Definition: lbaselib.cpp:149
static int luaB_getmetatable(lua_State *L)
Definition: lbaselib.cpp:126
static int luaB_assert(lua_State *L)
Definition: lbaselib.cpp:403
static int luaB_rawlen(lua_State *L)
Definition: lbaselib.cpp:157
static int luaB_collectgarbage(lua_State *L)
Definition: lbaselib.cpp:190
static int luaB_tostring(lua_State *L)
Definition: lbaselib.cpp:477
static int luaB_rawget(lua_State *L)
Definition: lbaselib.cpp:166
static int luaB_type(lua_State *L)
Definition: lbaselib.cpp:243
static int luaB_loadfile(lua_State *L)
Definition: lbaselib.cpp:318
static int luaB_error(lua_State *L)
Definition: lbaselib.cpp:114
static int luaB_rawset(lua_State *L)
Definition: lbaselib.cpp:174

Definition at line 484 of file lbaselib.cpp.