/*
** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
** Lua - An Extensible Extension Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
*/
#ifndef lua_h
#define global lua_h
//#include <stdarg.h>
//#include <stddef.h>
//#include "luaconf.h"
#uselib "lua5.1.dll"
#define global LUA_VERSION "Lua 5.1"
#define global LUA_RELEASE "Lua 5.1.4"
#define global LUA_VERSION_NUM 501
#define global LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
#define global LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
/* mark for precompiled code (`<esc>Lua') */
#define global LUA_SIGNATURE "\033Lua"
/* option for multiple returns in `lua_pcall' and `lua_call' */
#define global LUA_MULTRET (-1)
/*
** pseudo-indices
*/
#define global LUA_REGISTRYINDEX (-10000)
#define global LUA_ENVIRONINDEX (-10001)
#define global LUA_GLOBALSINDEX (-10002)
#define global lua_upvalueindex(%1) (LUA_GLOBALSINDEX-(%1))
/* thread status; 0 is OK */
#define global LUA_YIELD_ 1
#define global LUA_ERRRUN 2
#define global LUA_ERRSYNTAX 3
#define global LUA_ERRMEM 4
#define global LUA_ERRERR 5
//typedef struct lua_State lua_State;
//typedef int (*lua_CFunction) (lua_State *L);
/*
** functions that read/write blocks when loading/dumping Lua chunks
*/
//typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
//typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
/*
** prototype for memory-allocation functions
*/
//typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
/*
** basic types
*/
#define global LUA_TNONE (-1)
#define global LUA_TNIL 0
#define global LUA_TBOOLEAN 1
#define global LUA_TLIGHTUSERDATA 2
#define global LUA_TNUMBER 3
#define global LUA_TSTRING 4
#define global LUA_TTABLE 5
#define global LUA_TFUNCTION 6
#define global LUA_TUSERDATA 7
#define global LUA_TTHREAD 8
/* minimum Lua stack available to a C function */
#define global LUA_MINSTACK 20
/*
** generic extra include file
*/
//#if defined(LUA_USER_H)
//#include LUA_USER_H
//#endif
/* type of numbers in Lua */
//typedef LUA_NUMBER lua_Number;
/* type for integer functions */
//typedef LUA_INTEGER lua_Integer;
/*
** state manipulation
*/
#func global lua_newstate "lua_newstate" int, int;
#func global lua_close "lua_close" int;
#func global lua_newthread "lua_newthread" int;
#func global lua_atpanic "lua_atpanic" int, int;
/*
** basic stack manipulation
*/
#func global lua_gettop "lua_gettop" int;
#func global lua_settop "lua_settop" int, int;
#func global lua_pushvalue "lua_pushvalue" int, int;
#func global lua_remove "lua_remove" int, int;
#func global lua_insert "lua_insert" int, int;
#func global lua_replace "lua_replace" int, int;
#func global lua_checkstack "lua_checkstack" int, int;
#func global lua_xmove "lua_xmove" int, int, int;
/*
** access functions (stack -> C)
*/
#func global lua_isnumber "lua_isnumber" int, int;
#func global lua_isstring "lua_isstring" int, int;
#func global lua_iscfunction "lua_iscfunction" int, int;
#func global lua_isuserdata "lua_isuserdata" int, int;
#cfunc global lua_type "lua_type" int, int;
#func global lua_typename "lua_typename" int, int;
#func global lua_equal "lua_equal" int, int, int;
#func global lua_rawequal "lua_rawequal" int, int, int;
#func global lua_lessthan "lua_lessthan" int, int, int;
#func global lua_tonumber "lua_tonumber" int, int;
#func global lua_tointeger "lua_tointeger" int, int;
#func global lua_toboolean "lua_toboolean" int, int;
#func global lua_tolstring "lua_tolstring" int, int, int;
#func global lua_objlen "lua_objlen" int, int;
#func global lua_tocfunction "lua_tocfunction" int, int;
#func global lua_touserdata "lua_touserdata" int, int;
#func global lua_tothread "lua_tothread" int, int;
#func global lua_topointer "lua_topointer" int, int;
/*
** push functions (C -> stack)
*/
#func global lua_pushnil "lua_pushnil" int;
#func global lua_pushnumber "lua_pushnumber" int, int;
#func global lua_pushinteger "lua_pushinteger" int, int;
#func global lua_pushlstring "lua_pushlstring" int, str, int;
#func global lua_pushstring "lua_pushstring" int, str;
#func global lua_pushvfstring "lua_pushvfstring" int, str, int;
//#func global lua_pushfstring "lua_pushfstring" int, str, ...;
#func global lua_pushcclosure "lua_pushcclosure" int, int, int;
#func global lua_pushboolean "lua_pushboolean" int, int;
#func global lua_pushlightuserdata "lua_pushlightuserdata" int, int;
#func global lua_pushthread "lua_pushthread" int;
/*
** get functions (Lua -> stack)
*/
#func global lua_gettable "lua_gettable" int, int;
#func global lua_getfield "lua_getfield" int, int, str;
#func global lua_rawget "lua_rawget" int, int;
#func global lua_rawgeti "lua_rawgeti" int, int, int;
#func global lua_createtable "lua_createtable" int, int, int;
#func global lua_newuserdata "lua_newuserdata" int, int;
#func global lua_getmetatable "lua_getmetatable" int, int;
#func global lua_getfenv "lua_getfenv" int, int;
/*
** set functions (stack -> Lua)
*/
#func global lua_settable "lua_settable" int, int;
#func global lua_setfield "lua_setfield" int, int, str;
#func global lua_rawset "lua_rawset" int, int;
#func global lua_rawseti "lua_rawseti" int, int, int;
#func global lua_setmetatable "lua_setmetatable" int, int;
#func global lua_setfenv "lua_setfenv" int, int;
/*
** `load' and `call' functions (load and run Lua code)
*/
#func global lua_call "lua_call" int, int, int;
#func global lua_pcall "lua_pcall" int, int, int, int;
#func global lua_cpcall "lua_cpcall" int, int, int;
#func global lua_load "lua_load" int, int, int, str;
#func global lua_dump "lua_dump" int, int, int;
/*
** coroutine functions
*/
#func global lua_yield "lua_yield" int, int;
#func global lua_resume "lua_resume" int, int;
#func global lua_status "lua_status" int;
/*
** garbage-collection function and options
*/
#define global LUA_GCSTOP 0
#define global LUA_GCRESTART 1
#define global LUA_GCCOLLECT 2
#define global LUA_GCCOUNT 3
#define global LUA_GCCOUNTB 4
#define global LUA_GCSTEP 5
#define global LUA_GCSETPAUSE 6
#define global LUA_GCSETSTEPMUL 7
#func global lua_gc "lua_gc" int, int, int;
/*
** miscellaneous functions
*/
#func global lua_error "lua_error" int;
#func global lua_next "lua_next" int, int;
#func global lua_concat "lua_concat" int, int;
#func global lua_getallocf "lua_getallocf" int, int;
#func global lua_setallocf "lua_setallocf" int, int, int;
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define global lua_pop(%1,%2) lua_settop %1, -(%2)-1
#define global lua_newtable(%1) lua_createtable %1, 0, 0
#define global lua_register(%1,%2,%3) lua_pushcclosure %1,%3,0 :lua_setglobal %1,%2
#define global lua_pushcfunction(%1,%2) lua_pushcclosure %1, (%2), 0
#define global lua_strlen(%1,%2) lua_objlen %1, (%2)
#define global ctype lua_isfunction(%1,%2) (lua_type(%1, (%2)) == LUA_TFUNCTION)
#define global ctype lua_istable(%1,%2) (lua_type(%1, (%2)) == LUA_TTABLE)
#define global ctype lua_islightuserdata(%1,%2) (lua_type(%1, (%2)) == LUA_TLIGHTUSERDATA)
#define global ctype lua_isnil(%1,%2) (lua_type(%1, (%2)) == LUA_TNIL)
#define global ctype lua_isboolean(%1,%2) (lua_type(%1, (%2)) == LUA_TBOOLEAN)
#define global ctype lua_isthread(%1,%2) (lua_type(%1, (%2)) == LUA_TTHREAD)
#define global ctype lua_isnone(%1,%2) (lua_type(%1, (%2)) == LUA_TNONE)
#define global ctype lua_isnoneornil(%1, %2) (lua_type(%1, (%2)) <= 0)
#define global lua_pushliteral(%1, %2) lua_pushlstring %1, ""+%2, (strlen((""+%2))
#define global lua_setglobal(%1,%2) lua_setfield %1, LUA_GLOBALSINDEX, (%2)
#define global lua_getglobal(%1,%2) lua_getfield %1, LUA_GLOBALSINDEX, (%2)
#define global lua_tostring(%1,%2) lua_tolstring %1, (%2), 0
/*
** compatibility macros and functions
*/
#define global lua_open luaL_newstate
#define global lua_getregistry(%1) lua_pushvalue %1, LUA_REGISTRYINDEX
#define global lua_getgccount(%1) lua_gc %1, LUA_GCCOUNT, 0
#define global lua_Chunkreader lua_Reader
#define global lua_Chunkwriter lua_Writer
/* hack */
#func global lua_setlevel "lua_setlevel" int, int;
/*
** {======================================================================
** Debug API
** =======================================================================
*/
/*
** Event codes
*/
#define global LUA_HOOKCALL 0
#define global LUA_HOOKRET 1
#define global LUA_HOOKLINE 2
#define global LUA_HOOKCOUNT 3
#define global LUA_HOOKTAILRET 4
/*
** Event masks
*/
#define global LUA_MASKCALL (1 << LUA_HOOKCALL)
#define global LUA_MASKRET (1 << LUA_HOOKRET)
#define global LUA_MASKLINE (1 << LUA_HOOKLINE)
#define global LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
//typedef struct lua_Debug lua_Debug; /* activation record */
/* Functions to be called by the debuger in specific events */
//typedef void (*lua_Hook) int, lua_Debug *ar;
#func global lua_getstack "lua_getstack" int, int, int;
#func global lua_getinfo "lua_getinfo" int, str, int;
#func global lua_getlocal "lua_getlocal" int, int, int;
#func global lua_setlocal "lua_setlocal" int, int, int;
#func global lua_getupvalue "lua_getupvalue" int, int, int;
#func global lua_setupvalue "lua_setupvalue" int, int, int;
#func global lua_sethook "lua_sethook" int, int, int, int;
#func global lua_gethook "lua_gethook" int;
#func global lua_gethookmask "lua_gethookmask" int;
#func global lua_gethookcount "lua_gethookcount" int;
//struct lua_Debug {
// int event;
// const char *name; /* (n) */
// const char *namewhat; /* (n) `global', `local', `field', `method' */
// const char *what; /* (S) `Lua', `C', `main', `tail' */
// const char *source; /* (S) */
// int currentline; /* (l) */
// int nups; /* (u) number of upvalues */
// int linedefined; /* (S) */
// int lastlinedefined; /* (S) */
// char short_src[LUA_IDSIZE]; /* (S) */
// /* private part */
// int i_ci; /* active function */
//};
/* }====================================================================== */
/******************************************************************************
* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#endif
;///////////////////////////////////////////////////////////////////////////////
/*
** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define global lauxlib_h
//#include <stddef.h>
//#include <stdio.h>
//#include "lua.h"
#uselib "lua5.1.dll"
//#if defined(LUA_COMPAT_GETN)
#func global luaL_getn "luaL_getn" int, int;
#func global luaL_setn "luaL_setn" int, int, int;
//#else
//#define global luaL_getn(L,i) ((int)lua_objlen(L, i))
//#define global luaL_setn(L,i,j) ((void)0) /* no op! */
//#endif
//#if defined(LUA_COMPAT_OPENLIB)
#define global luaI_openlib luaL_openlib
//#endif
/* extra error code for `luaL_load' */
#define global LUA_ERRFILE (LUA_ERRERR+1)
//typedef struct luaL_Reg {
// const char *name;
// lua_CFunction func;
//} luaL_Reg;
#func global luaI_openlib "luaI_openlib" int, str, int, int;
#func global luaL_register "luaL_register" int, str, int;
#func global luaL_getmetafield "luaL_getmetafield" int, int, str;
#func global luaL_callmeta "luaL_callmeta" int, int, str;
#func global luaL_typerror "luaL_typerror" int, int, str;
#cfunc global luaL_argerror "luaL_argerror" int, int, str;
#func global luaL_checklstring "luaL_checklstring" int, int, int;
#func global luaL_optlstring "luaL_optlstring" int, int, str, int;
#func global luaL_checknumber "luaL_checknumber" int, int;
#func global luaL_optnumber "luaL_optnumber" int, int, int;
#func global luaL_checkinteger "luaL_checkinteger" int, int;
#func global luaL_optinteger "luaL_optinteger" int, int, int;
#func global luaL_checkstack "luaL_checkstack" int, int, str;
#func global luaL_checktype "luaL_checktype" int, int, int;
#func global luaL_checkany "luaL_checkany" int, int;
#func global luaL_newmetatable "luaL_newmetatable" int, str;
#func global luaL_checkudata "luaL_checkudata" int, int, str;
#func global luaL_where "luaL_where" int, int;
//#func global luaL_error "luaL_error" int, str, ...;
#func global luaL_checkoption "luaL_checkoption" int, int, str, int;
#func global luaL_ref "luaL_ref" int, int;
#func global luaL_unref "luaL_unref" int, int, int;
#func global luaL_loadfile "luaL_loadfile" int, str;
#func global luaL_loadbuffer "luaL_loadbuffer" int, str, int, str;
#func global luaL_loadstring "luaL_loadstring" int, str;
#func global luaL_newstate "luaL_newstate" ;
#func global luaL_gsub "luaL_gsub" int, str, str, str;
#func global luaL_findtable "luaL_findtable" int, int, str, int;
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define global ctype luaL_argcheck(%1, %2,%3,%4) ((%2) || luaL_argerror(%1, (%3), (%4)))
#define global luaL_checkstring(%1,%2) luaL_checklstring %1, (%2), 0
#define global luaL_optstring(%1,%2,%3) luaL_optlstring %1, (%2), (%3), 0
#define global luaL_checkint(%1,%2) luaL_checkinteger %1, (%2)
#define global luaL_optint(%1,%2,%3) luaL_optinteger %1, (%2), (%3)
#define global luaL_checklong(%1,%2) luaL_checkinteger %1, (%2)
#define global luaL_optlong(%1,%2,%3) luaL_optinteger %1, (%2), (%3)
#define global luaL_typename(%1,%2) lua_typename %1, lua_type(%1,(%2))
#define global luaL_dofile(%1, %2) luaL_loadfile %1, %2:_lauxlib_stat_=stat : lua_pcall %1, 0, LUA_MULTRET, 0 :_lauxlib_stat_=(_lauxlib_stat_||stat) :mref _lauxlib_stat_,64
#define global luaL_dostring(%1, %2) luaL_loadstring %1,%2 :_lauxlib_stat_=stat :lua_pcall %1, 0, LUA_MULTRET, 0 :_lauxlib_stat_=(_lauxlib_stat_||stat) :mref _lauxlib_stat_,64
#define global luaL_getmetatable(%1,%2) lua_getfield %1, LUA_REGISTRYINDEX, (%2)
//#define global luaL_opt(%1,%2,%3,%4) if lua_isnoneornil(%1,(%3)) { _lauxlib_stat_=(%4) :mref _lauxlib_stat_,64 }else{ %2(%1,(%3)) }
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
//typedef struct luaL_Buffer {
// char *p; /* current position in buffer */
// int lvl; /* number of strings in the stack (level) */
// lua_State *L;
// char buffer[LUAL_BUFFERSIZE];
//} luaL_Buffer;
//#define global luaL_addchar(%1,%2) \
// ((void)((%1)->p < ((%1)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(%1)), \
// (*(%1)->p++ = (char)(%2)))
/* compatibility only */
//#define global luaL_putchar(%1,%2) luaL_addchar(%1,%2)
#define global luaL_addsize(%1,%2) (%1(0) += (%2))
#func global luaL_buffinit "luaL_buffinit" int, int;
#func global luaL_prepbuffer "luaL_prepbuffer" int;
#func global luaL_addlstring "luaL_addlstring" int, str, int;
#func global luaL_addstring "luaL_addstring" int, str;
#func global luaL_addvalue "luaL_addvalue" int;
#func global luaL_pushresult "luaL_pushresult" int;
/* }====================================================== */
/* compatibility with ref system */
/* pre-defined references */
#define global LUA_NOREF (-2)
#define global LUA_REFNIL (-1)
#define global lua_ref(%1,%2) if %2 {luaL_ref %1, LUA_REGISTRYINDEX}else{lua_pushstring %1, "unlocked references are obsolete":lua_error(%1):_lauxlib_stat_=0:mref _lauxlib_stat_,64}
#define global lua_unref(%1,%2) luaL_unref %1, LUA_REGISTRYINDEX, (%2)
#define global lua_getref(%1,%2) lua_rawgeti %1, LUA_REGISTRYINDEX, (%2)
//#define global luaL_reg luaL_Reg
#endif
;///////////////////////////////////////////////////////////////////////////////
/*
** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $
** Lua standard libraries
** See Copyright Notice in lua.h
*/
#ifndef lualib_h
#define global lualib_h
//#include "lua.h"
#uselib "lua5.1.dll""
/* Key to file-handle type */
#define global LUA_FILEHANDLE "FILE*"
#define global LUA_COLIBNAME "coroutine"
#func global luaopen_base "luaopen_base" int;
#define global LUA_TABLIBNAME "table"
#func global luaopen_table "luaopen_table" int;
#define global LUA_IOLIBNAME "io"
#func global luaopen_io "luaopen_io" int;
#define global LUA_OSLIBNAME "os"
#func global luaopen_os "luaopen_os" int;
#define global LUA_STRLIBNAME "string"
#func global luaopen_string "luaopen_string" int;
#define global LUA_MATHLIBNAME "math"
#func global luaopen_math "luaopen_math" int;
#define global LUA_DBLIBNAME "debug"
#func global luaopen_debug "luaopen_debug" int;
#define global LUA_LOADLIBNAME "package"
#func global luaopen_package "luaopen_package" int;
/* open all previous libraries */
#func global luaL_openlibs "luaL_openlibs" int;
#ifndef lua_assert
#define global lua_assert(%1) (0)
#endif
#endif