lauxlib.cpp File Reference

#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"

Go to the source code of this file.

Classes

struct  LoadF
struct  LoadS

Defines

#define lauxlib_c
#define LUA_LIB
#define FREELIST_REF   0
#define abs_index(L, i)
#define bufflen(B)   ((B)->p - (B)->buffer)
#define bufffree(B)   ((size_t)(LUAL_BUFFERSIZE - bufflen(B)))
#define LIMIT   (LUA_MINSTACK/2)

Functions

LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg)
LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname)
static void tag_error (lua_State *L, int narg, int tag)
LUALIB_API void luaL_where (lua_State *L, int level)
LUALIB_API int luaL_error (lua_State *L, const char *fmt,...)
LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, const char *const lst[])
LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname)
LUALIB_API void * luaL_checkudata (lua_State *L, int ud, const char *tname)
LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes)
LUALIB_API void luaL_checktype (lua_State *L, int narg, int t)
LUALIB_API void luaL_checkany (lua_State *L, int narg)
LUALIB_API const char * luaL_checklstring (lua_State *L, int narg, size_t *len)
LUALIB_API const char * luaL_optlstring (lua_State *L, int narg, const char *def, size_t *len)
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg)
LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def)
LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg)
LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, lua_Integer def)
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event)
LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event)
LUALIB_API void() luaL_register (lua_State *L, const char *libname, const luaL_Reg *l)
static int libsize (const luaL_Reg *l)
LUALIB_API void luaI_openlib (lua_State *L, const char *libname, const luaL_Reg *l, int nup)
LUALIB_API const char * luaL_gsub (lua_State *L, const char *s, const char *p, const char *r)
LUALIB_API const char * luaL_findtable (lua_State *L, int idx, const char *fname, int szhint)
static int emptybuffer (luaL_Buffer *B)
static void adjuststack (luaL_Buffer *B)
LUALIB_API char * luaL_prepbuffer (luaL_Buffer *B)
LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l)
LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s)
LUALIB_API void luaL_pushresult (luaL_Buffer *B)
LUALIB_API void luaL_addvalue (luaL_Buffer *B)
LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B)
LUALIB_API int luaL_ref (lua_State *L, int t)
LUALIB_API void luaL_unref (lua_State *L, int t, int ref)
static const char * getF (lua_State *L, void *ud, size_t *size)
static int errfile (lua_State *L, const char *what, int fnameindex)
LUALIB_API int luaL_loadfile (lua_State *L, const char *filename)
static const char * getS (lua_State *L, void *ud, size_t *size)
LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, const char *name)
LUALIB_API int() luaL_loadstring (lua_State *L, const char *s)
static void * l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
static int panic (lua_State *L)
LUALIB_API lua_StateluaL_newstate (void)


Define Documentation

#define abs_index ( L,
 ) 

Value:

((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \
                                        lua_gettop(L) + (i) + 1)

Definition at line 32 of file lauxlib.cpp.

Referenced by luaL_callmeta(), luaL_ref(), and luaL_unref().

#define bufffree (  )     ((size_t)(LUAL_BUFFERSIZE - bufflen(B)))

Definition at line 393 of file lauxlib.cpp.

Referenced by luaL_addvalue().

#define bufflen (  )     ((B)->p - (B)->buffer)

Definition at line 392 of file lauxlib.cpp.

Referenced by emptybuffer().

#define FREELIST_REF   0

Definition at line 28 of file lauxlib.cpp.

Referenced by luaL_ref(), and luaL_unref().

#define lauxlib_c

Definition at line 20 of file lauxlib.cpp.

#define LIMIT   (LUA_MINSTACK/2)

Definition at line 395 of file lauxlib.cpp.

Referenced by adjuststack().

#define LUA_LIB

Definition at line 21 of file lauxlib.cpp.


Function Documentation

static void adjuststack ( luaL_Buffer B  )  [static]

Definition at line 410 of file lauxlib.cpp.

References luaL_Buffer::L, LIMIT, lua_concat(), lua_strlen, and luaL_Buffer::lvl.

Referenced by luaL_addvalue(), and luaL_prepbuffer().

static int emptybuffer ( luaL_Buffer B  )  [static]

Definition at line 398 of file lauxlib.cpp.

References luaL_Buffer::buffer, bufflen, luaL_Buffer::L, lua_pushlstring(), luaL_Buffer::lvl, and luaL_Buffer::p.

Referenced by luaL_addvalue(), luaL_prepbuffer(), and luaL_pushresult().

static int errfile ( lua_State L,
const char *  what,
int  fnameindex 
) [static]

Definition at line 543 of file lauxlib.cpp.

References LUA_ERRFILE, lua_pushfstring(), lua_remove(), and lua_tostring.

Referenced by luaL_loadfile().

static const char* getF ( lua_State L,
void *  ud,
size_t *  size 
) [static]

Definition at line 529 of file lauxlib.cpp.

References LoadF::buff, LoadF::extraline, LoadF::f, LUAL_BUFFERSIZE, and NULL.

Referenced by luaL_loadfile().

static const char* getS ( lua_State L,
void *  ud,
size_t *  size 
) [static]

Definition at line 600 of file lauxlib.cpp.

References NULL, LoadS::s, and LoadS::size.

Referenced by luaL_loadbuffer().

static void* l_alloc ( void *  ud,
void *  ptr,
size_t  osize,
size_t  nsize 
) [static]

Definition at line 628 of file lauxlib.cpp.

References NULL.

Referenced by luaL_newstate().

static int libsize ( const luaL_Reg l  )  [static]

Definition at line 235 of file lauxlib.cpp.

References luaL_Reg::name.

Referenced by luaI_openlib().

LUALIB_API void luaI_openlib ( lua_State L,
const char *  libname,
const luaL_Reg l,
int  nup 
)

Definition at line 242 of file lauxlib.cpp.

LUALIB_API void luaL_addlstring ( luaL_Buffer B,
const char *  s,
size_t  l 
)

Definition at line 436 of file lauxlib.cpp.

Referenced by add_s(), addquoted(), luaL_addstring(), luaL_gsub(), os_date(), str_format(), str_gsub(), str_rep(), tconcat(), and writer().

LUALIB_API void luaL_addstring ( luaL_Buffer B,
const char *  s 
)

Definition at line 442 of file lauxlib.cpp.

Referenced by luaL_gsub().

LUALIB_API void luaL_addvalue ( luaL_Buffer B  ) 

Definition at line 454 of file lauxlib.cpp.

Referenced by add_s(), add_value(), str_format(), and tconcat().

LUALIB_API int luaL_argerror ( lua_State L,
int  narg,
const char *  extramsg 
)

Definition at line 43 of file lauxlib.cpp.

Referenced by add_value(), db_getinfo(), db_getlocal(), db_setlocal(), fileerror(), g_read(), getfunc(), luaL_checkany(), luaL_checkoption(), and luaL_typerror().

LUALIB_API void luaL_buffinit ( lua_State L,
luaL_Buffer B 
)

Definition at line 472 of file lauxlib.cpp.

Referenced by luaL_gsub(), os_date(), read_chars(), read_line(), str_char(), str_dump(), str_format(), str_gsub(), str_lower(), str_rep(), str_reverse(), str_upper(), and tconcat().

LUALIB_API int luaL_callmeta ( lua_State L,
int  obj,
const char *  event 
)

Definition at line 219 of file lauxlib.cpp.

Referenced by luaB_tostring().

LUALIB_API void luaL_checkany ( lua_State L,
int  narg 
)

Definition at line 152 of file lauxlib.cpp.

Referenced by db_getmetatable(), db_setlocal(), db_setupvalue(), io_type(), luaB_assert(), luaB_getmetatable(), luaB_pcall(), luaB_rawequal(), luaB_rawget(), luaB_rawset(), luaB_tonumber(), luaB_tostring(), luaB_type(), and luaB_xpcall().

LUALIB_API lua_Integer luaL_checkinteger ( lua_State L,
int  narg 
)

Definition at line 189 of file lauxlib.cpp.

Referenced by luaL_optinteger(), and str_sub().

LUALIB_API const char* luaL_checklstring ( lua_State L,
int  narg,
size_t *  len 
)

Definition at line 158 of file lauxlib.cpp.

Referenced by addquoted(), g_write(), luaB_loadstring(), luaL_optlstring(), str_byte(), str_find_aux(), str_format(), str_gsub(), str_len(), str_lower(), str_rep(), str_reverse(), str_sub(), and str_upper().

LUALIB_API lua_Number luaL_checknumber ( lua_State L,
int  narg 
)

Definition at line 176 of file lauxlib.cpp.

Referenced by LUAUtil::getIntFromTable(), LUAUtil::getNumberFromTable(), LUAUtil::getVectorFromStack(), luaL_optnumber(), math_abs(), math_acos(), math_ceil(), math_cos(), math_exp(), math_floor(), math_log(), math_log10(), math_max(), math_min(), math_pow(), math_sin(), math_sqrt(), math_tan(), os_date(), os_difftime(), s3d_explosion(), s3d_fire_weapon(), s3d_get_height(), s3d_get_tank(), s3d_laser(), s3d_napalm(), and str_format().

LUALIB_API int luaL_checkoption ( lua_State L,
int  narg,
const char *  def,
const char *const   lst[] 
)

Definition at line 99 of file lauxlib.cpp.

Referenced by f_seek(), f_setvbuf(), luaB_collectgarbage(), and os_setlocale().

LUALIB_API void luaL_checkstack ( lua_State L,
int  space,
const char *  mes 
)

Definition at line 140 of file lauxlib.cpp.

Referenced by g_read(), generic_reader(), getargs(), luaB_unpack(), push_captures(), sort(), and str_byte().

LUALIB_API void luaL_checktype ( lua_State L,
int  narg,
int  t 
)

Definition at line 146 of file lauxlib.cpp.

Referenced by auxupvalue(), db_setfenv(), db_sethook(), foreach(), foreachi(), LUAUtil::getVectorFromStack(), ActionParams::initLUA(), ipairsaux(), ll_seeall(), luaB_ipairs(), luaB_load(), luaB_next(), luaB_pairs(), luaB_rawget(), luaB_rawset(), luaB_setfenv(), luaB_setmetatable(), luaB_unpack(), maxn(), os_time(), NapalmParams::parseLUA(), LaserParams::parseLUA(), ExplosionParams::parseLUA(), setn(), sort(), str_dump(), and tconcat().

LUALIB_API void* luaL_checkudata ( lua_State L,
int  ud,
const char *  tname 
)

Definition at line 124 of file lauxlib.cpp.

Referenced by gctm().

LUALIB_API int luaL_error ( lua_State L,
const char *  fmt,
  ... 
)

Definition at line 86 of file lauxlib.cpp.

Referenced by add_value(), auxresume(), auxsort(), capture_to_close(), check_capture(), classend(), db_setfenv(), findfile(), generic_reader(), getfield(), getfunc(), getiofile(), gfind_nodef(), io_readline(), ll_module(), ll_require(), loader_preload(), loaderror(), lstop(), luaB_assert(), luaB_print(), luaB_setfenv(), luaB_setmetatable(), luaI_openlib(), luaL_argerror(), luaL_checkstack(), match(), matchbalance(), os_tmpname(), push_onecapture(), scanformat(), setn(), start_capture(), str_byte(), str_dump(), str_format(), tinsert(), and tofile().

LUALIB_API const char* luaL_findtable ( lua_State L,
int  idx,
const char *  fname,
int  szhint 
)

Definition at line 357 of file lauxlib.cpp.

Referenced by ll_module(), luaI_openlib(), and luaopen_package().

LUALIB_API int luaL_getmetafield ( lua_State L,
int  obj,
const char *  event 
)

Definition at line 203 of file lauxlib.cpp.

Referenced by luaB_getmetatable(), luaB_setmetatable(), and luaL_callmeta().

LUALIB_API const char* luaL_gsub ( lua_State L,
const char *  s,
const char *  p,
const char *  r 
)

Definition at line 340 of file lauxlib.cpp.

Referenced by findfile(), mkfuncname(), and setpath().

LUALIB_API int luaL_loadbuffer ( lua_State L,
const char *  buff,
size_t  size,
const char *  name 
)

Definition at line 610 of file lauxlib.cpp.

Referenced by db_debug(), dostring(), loadline(), luaB_loadstring(), and luaL_loadstring().

LUALIB_API int luaL_loadfile ( lua_State L,
const char *  filename 
)

Definition at line 552 of file lauxlib.cpp.

Referenced by dofile(), handle_script(), loader_Lua(), luaB_dofile(), luaB_loadfile(), and pmain().

LUALIB_API int() luaL_loadstring ( lua_State L,
const char *  s 
)

Definition at line 619 of file lauxlib.cpp.

LUALIB_API int luaL_newmetatable ( lua_State L,
const char *  tname 
)

Definition at line 112 of file lauxlib.cpp.

Referenced by createmeta(), and luaopen_package().

LUALIB_API lua_State* luaL_newstate ( void   ) 

Definition at line 648 of file lauxlib.cpp.

LUALIB_API lua_Integer luaL_optinteger ( lua_State L,
int  narg,
lua_Integer  def 
)

Definition at line 197 of file lauxlib.cpp.

Referenced by f_setvbuf(), str_byte(), str_find_aux(), and str_sub().

LUALIB_API const char* luaL_optlstring ( lua_State L,
int  narg,
const char *  def,
size_t *  len 
)

Definition at line 165 of file lauxlib.cpp.

Referenced by tconcat().

LUALIB_API lua_Number luaL_optnumber ( lua_State L,
int  narg,
lua_Number  def 
)

Definition at line 184 of file lauxlib.cpp.

Referenced by os_difftime().

LUALIB_API char* luaL_prepbuffer ( luaL_Buffer B  ) 

Definition at line 429 of file lauxlib.cpp.

Referenced by read_chars(), and read_line().

LUALIB_API void luaL_pushresult ( luaL_Buffer B  ) 

Definition at line 447 of file lauxlib.cpp.

Referenced by luaL_gsub(), os_date(), read_chars(), read_line(), str_char(), str_dump(), str_format(), str_gsub(), str_lower(), str_rep(), str_reverse(), str_upper(), and tconcat().

LUALIB_API int luaL_ref ( lua_State L,
int  t 
)

Definition at line 481 of file lauxlib.cpp.

LUALIB_API void() luaL_register ( lua_State L,
const char *  libname,
const luaL_Reg l 
)

Definition at line 229 of file lauxlib.cpp.

Referenced by base_open(), createmeta(), luaopen_base(), luaopen_debug(), luaopen_io(), luaopen_math(), luaopen_os(), luaopen_package(), luaopen_s3d(), luaopen_s3dweapon(), luaopen_string(), and luaopen_table().

LUALIB_API int luaL_typerror ( lua_State L,
int  narg,
const char *  tname 
)

Definition at line 61 of file lauxlib.cpp.

Referenced by luaL_checkudata(), and tag_error().

LUALIB_API void luaL_unref ( lua_State L,
int  t,
int  ref 
)

Definition at line 504 of file lauxlib.cpp.

LUALIB_API void luaL_where ( lua_State L,
int  level 
)

Definition at line 73 of file lauxlib.cpp.

Referenced by luaB_auxwrap(), luaB_error(), and luaL_error().

static int panic ( lua_State L  )  [static]

Definition at line 640 of file lauxlib.cpp.

References lua_tostring.

Referenced by luaD_throw(), and luaL_newstate().

static void tag_error ( lua_State L,
int  narg,
int  tag 
) [static]

Definition at line 68 of file lauxlib.cpp.

References lua_typename(), and luaL_typerror().

Referenced by luaL_checkinteger(), luaL_checklstring(), luaL_checknumber(), and luaL_checktype().


Generated on Mon Feb 16 15:14:58 2009 for Scorched3D by  doxygen 1.5.3