52 else if (
findfield(L, objidx, level - 1)) {
85 else if (*ar->
what ==
'm')
87 else if (*ar->
what ==
'C') {
155 return luaL_error(L,
"bad argument #%d (%s)", narg, extramsg);
157 if (strcmp(ar.
namewhat,
"method") == 0) {
166 narg, ar.
name, extramsg);
227 #if !defined(inspectstat)
229 #if defined(LUA_USE_POSIX)
231 #include <sys/wait.h>
236 #define inspectstat(stat,what) \
237 if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \
238 else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; }
242 #define inspectstat(stat,what)
250 const char *
what =
"exit";
255 if (*what ==
'e' && stat == 0)
323 const char *
const lst[]) {
327 for (i=0; lst[
i]; i++)
328 if (strcmp(lst[i], name) == 0)
367 const char *def,
size_t *
len) {
370 *len = (def ? strlen(def) : 0);
433 #define buffonstack(B) ((B)->b != (B)->initb)
441 if (B->
size - B->
n < sz) {
443 size_t newsize = B->
size * 2;
444 if (newsize - B->
n < sz)
446 if (newsize < B->
n || newsize - B->
n < sz)
451 memcpy(newbuff, B->
b, B->
n *
sizeof(
char));
463 memcpy(b, s, l *
sizeof(
char));
582 if (feof(lf->
f))
return NULL;
583 *size = fread(lf->
buff, 1,
sizeof(lf->
buff), lf->
f);
590 const char *serr = strerror(errno);
599 const char *
p =
"\xEF\xBB\xBF";
604 if (c == EOF || c != *(
const unsigned char *)p++)
return c;
606 }
while (*p !=
'\0');
624 }
while (c != EOF && c !=
'\n') ;
635 int status, readstatus;
638 if (filename == NULL) {
644 lf.
f = fopen(filename,
"r");
645 if (lf.
f == NULL)
return errfile(L,
"open", fnameindex);
648 lf.
buff[lf.
n++] =
'\n';
650 lf.
f = freopen(filename,
"rb", lf.
f);
651 if (lf.
f == NULL)
return errfile(L,
"reopen", fnameindex);
657 readstatus = ferror(lf.
f);
658 if (filename) fclose(lf.
f);
661 return errfile(L,
"read", fnameindex);
677 if (ls->
size == 0)
return NULL;
685 const char *
name,
const char *
mode) {
733 luaL_error(L,
"object length is not a number");
767 #if defined(LUA_COMPAT_MODULE)
770 const char *fname,
int szhint) {
774 e = strchr(fname,
'.');
775 if (e == NULL) e = fname + strlen(fname);
801 for (; l && l->
name; l++) size++;
853 for (; l->
name != NULL; l++) {
855 for (i = 0; i < nup; i++)
907 size_t l = strlen(p);
910 while ((wild = strstr(s, p)) != NULL) {
921 static void *
l_alloc (
void *ud,
void *ptr,
size_t osize,
size_t nsize) {
928 return realloc(ptr, nsize);
951 luaL_error(L,
"version mismatch: app. needs %f, Lua core provides %f",
958 " must recompile Lua with proper settings");
#define luaL_addsize(B, s)
LUA_API void lua_rawgeti(lua_State *L, int idx, int n)
LUALIB_API void luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb)
#define lua_isnoneornil(L, n)
LUALIB_API void luaL_addvalue(luaL_Buffer *B)
LUALIB_API void * luaL_checkudata(lua_State *L, int ud, const char *tname)
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
#define lua_pushcfunction(L, f)
LUA_API void lua_getfield(lua_State *L, int idx, const char *k)
LUALIB_API lua_Integer luaL_checkinteger(lua_State *L, int narg)
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
LUALIB_API lua_State * luaL_newstate(void)
LUALIB_API const char * luaL_tolstring(lua_State *L, int idx, size_t *len)
LUA_API void lua_settop(lua_State *L, int idx)
LUA_API int lua_type(lua_State *L, int idx)
LUALIB_API char * luaL_prepbuffsize(luaL_Buffer *B, size_t sz)
LUALIB_API int luaL_loadstring(lua_State *L, const char *s)
LUALIB_API const char * luaL_optlstring(lua_State *L, int narg, const char *def, size_t *len)
static const char * luaL_findtable(lua_State *L, int idx, const char *fname, int szhint)
LUA_API void lua_pushboolean(lua_State *L, int b)
LUALIB_API int luaL_ref(lua_State *L, int t)
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)
static int errfile(lua_State *L, const char *what, int fnameindex)
LUALIB_API void luaL_checktype(lua_State *L, int narg, int t)
char buff[LUAL_BUFFERSIZE]
LUALIB_API void luaL_pushresult(luaL_Buffer *B)
LUALIB_API int luaL_getmetafield(lua_State *L, int obj, const char *event)
LUA_API int lua_gettop(lua_State *L)
LUA_API const lua_Number * lua_version(lua_State *L)
static const char * getS(lua_State *L, void *ud, size_t *size)
static int skipcomment(LoadF *lf, int *cp)
LUA_API void lua_settable(lua_State *L, int idx)
#define lua_tointeger(L, i)
static int countlevels(lua_State *L)
#define luaL_getmetatable(L, n)
LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename, const char *mode)
const char * what() const
#define luaL_typename(L, i)
char short_src[LUA_IDSIZE]
LUALIB_API void luaL_checkstack(lua_State *L, int space, const char *msg)
LUALIB_API void luaL_addstring(luaL_Buffer *B, const char *s)
LUA_API void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n)
LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
LUALIB_API void luaL_setmetatable(lua_State *L, const char *tname)
LUA_API int lua_absindex(lua_State *L, int idx)
char initb[LUAL_BUFFERSIZE]
LUALIB_API lua_Integer luaL_optinteger(lua_State *L, int narg, lua_Integer def)
LUA_API void * lua_newuserdata(lua_State *L, size_t size)
int(* lua_CFunction)(lua_State *L)
static int pushglobalfuncname(lua_State *L, lua_Debug *ar)
#define luaL_loadbuffer(L, s, sz, n)
GLdouble GLdouble GLdouble b
LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum)
LUALIB_API void luaL_pushresultsize(luaL_Buffer *B, size_t sz)
LUA_API void lua_setglobal(lua_State *L, const char *var)
LUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname)
LUALIB_API const char * luaL_gsub(lua_State *L, const char *s, const char *p, const char *r)
LUALIB_API int luaL_checkoption(lua_State *L, int narg, const char *def, const char *const lst[])
LUA_API int lua_rawequal(lua_State *L, int index1, int index2)
LUA_API lua_Unsigned lua_tounsignedx(lua_State *L, int idx, int *isnum)
LUALIB_API int luaL_loadbufferx(lua_State *L, const char *buff, size_t size, const char *name, const char *mode)
#define luaL_opt(L, f, n, d)
LUA_API int lua_toboolean(lua_State *L, int idx)
static void * l_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
#define inspectstat(stat, what)
#define lua_pushglobaltable(L)
LUALIB_API void luaL_buffinit(lua_State *L, luaL_Buffer *B)
static void tag_error(lua_State *L, int narg, int tag)
LUA_API const char * lua_pushlstring(lua_State *L, const char *s, size_t len)
LUALIB_API void luaL_where(lua_State *L, int level)
LUA_API int lua_getmetatable(lua_State *L, int objindex)
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int narg)
LUA_API int lua_setmetatable(lua_State *L, int objindex)
LUA_API void lua_remove(lua_State *L, int idx)
LUA_API const char * lua_tolstring(lua_State *L, int idx, size_t *len)
LUALIB_API void * luaL_testudata(lua_State *L, int ud, const char *tname)
LUALIB_API int luaL_callmeta(lua_State *L, int obj, const char *event)
#define lua_tounsigned(L, i)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
LUALIB_API void luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level)
LUALIB_API lua_Unsigned luaL_optunsigned(lua_State *L, int narg, lua_Unsigned def)
LUA_API lua_Number lua_tonumberx(lua_State *L, int idx, int *isnum)
LUALIB_API void luaL_addlstring(luaL_Buffer *B, const char *s, size_t l)
LUA_API void lua_pushnil(lua_State *L)
LUA_API void lua_pushnumber(lua_State *L, lua_Number n)
LUALIB_API const char * luaL_checklstring(lua_State *L, int narg, size_t *len)
LUA_API void lua_len(lua_State *L, int idx)
#define lua_pushliteral(L, s)
LUALIB_API lua_Number luaL_optnumber(lua_State *L, int narg, lua_Number def)
LUALIB_API int luaL_newmetatable(lua_State *L, const char *tname)
LUA_API void * lua_touserdata(lua_State *L, int idx)
#define luaL_checkversion(L)
const std::string space
whitespace is possible
LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
LUALIB_API lua_Unsigned luaL_checkunsigned(lua_State *L, int narg)
LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode)
LUALIB_API int luaL_argerror(lua_State *L, int narg, const char *extramsg)
#define lua_tostring(L, i)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
LUA_API void lua_rawseti(lua_State *L, int idx, int n)
static const char * getF(lua_State *L, void *ud, size_t *size)
LUA_API lua_State * lua_newstate(lua_Alloc f, void *ud)
LUA_API void lua_insert(lua_State *L, int idx)
GLdouble GLdouble GLdouble r
LUA_API void lua_pushvalue(lua_State *L, int idx)
LUA_API const char * lua_pushvfstring(lua_State *L, const char *fmt, va_list argp)
LUA_UNSIGNED lua_Unsigned
#define lua_call(L, n, r)
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
#define luai_writestringerror(s, p)
GLuint const GLchar * name
static int libsize(const luaL_Reg *l)
LUA_API size_t lua_rawlen(lua_State *L, int idx)
#define LUA_REGISTRYINDEX
LUA_API lua_CFunction lua_atpanic(lua_State *L, lua_CFunction panicf)
LUA_API int lua_error(lua_State *L)
LUA_API const void * lua_topointer(lua_State *L, int idx)
LUALIB_API char * luaL_buffinitsize(lua_State *L, luaL_Buffer *B, size_t sz)
LUALIB_API void luaL_checkversion_(lua_State *L, lua_Number ver)
#define lua_istable(L, n)
LUA_API void lua_concat(lua_State *L, int n)
LUALIB_API void luaL_checkany(lua_State *L, int narg)
LUALIB_API int luaL_execresult(lua_State *L, int stat)
static int skipBOM(LoadF *lf)
static int panic(lua_State *L)
static void pushfuncname(lua_State *L, lua_Debug *ar)
LUA_API int lua_checkstack(lua_State *L, int size)
LUALIB_API void luaL_unref(lua_State *L, int t, int ref)
LUA_API const char * lua_pushfstring(lua_State *L, const char *fmt,...)
static int typeerror(lua_State *L, int narg, const char *tname)
LUALIB_API void luaL_openlib(lua_State *L, const char *libname, const luaL_Reg *l, int nup)
LUALIB_API int luaL_len(lua_State *L, int idx)
LUA_API void lua_copy(lua_State *L, int fromidx, int toidx)
LUALIB_API void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
static int findfield(lua_State *L, int objidx, int level)
LUALIB_API void luaL_pushmodule(lua_State *L, const char *modname, int sizehint)
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
#define luaL_optstring(L, n, d)
LUALIB_API int luaL_typerror(lua_State *L, int narg, const char *tname)
LUA_API void lua_rawget(lua_State *L, int idx)
LUA_API const char * lua_pushstring(lua_State *L, const char *s)
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
LUA_API int lua_next(lua_State *L, int idx)
LUA_API const char * lua_typename(lua_State *L, int t)
#define luaL_checkstring(L, n)