├── bin ├── linux │ ├── gluac │ ├── libsteam.so │ ├── libtier0.so │ ├── lua_shared.so │ └── gluac.sh └── windows │ ├── gluac.exe │ ├── gluac.pdb │ ├── tier0.dll │ └── lua_shared.dll ├── README.md ├── premake4.lua └── src ├── lua_dyn.c ├── gluac.c └── lua_dyn.h /bin/linux/gluac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/linux/gluac -------------------------------------------------------------------------------- /bin/linux/libsteam.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/linux/libsteam.so -------------------------------------------------------------------------------- /bin/linux/libtier0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/linux/libtier0.so -------------------------------------------------------------------------------- /bin/windows/gluac.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/windows/gluac.exe -------------------------------------------------------------------------------- /bin/windows/gluac.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/windows/gluac.pdb -------------------------------------------------------------------------------- /bin/windows/tier0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/windows/tier0.dll -------------------------------------------------------------------------------- /bin/linux/lua_shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/linux/lua_shared.so -------------------------------------------------------------------------------- /bin/windows/lua_shared.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkacjios/gluac-multiarch/HEAD/bin/windows/lua_shared.dll -------------------------------------------------------------------------------- /bin/linux/gluac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_LIBRARY_PATH="~/.steam/ubuntu12_32:~/.steam/steam/steamapps/common/GarrysMod/bin:$LD_LIBRARY_PATH" 3 | ./gluac -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GLuaC 2 | 3 | ``` 4 | usage: gluac [options] [filenames]. 5 | Available options are: 6 | - process stdin 7 | -o name output to file 'name' (default is "gluac.out") 8 | -p parse only 9 | -v show version information 10 | -- stop handling options 11 | ``` -------------------------------------------------------------------------------- /premake4.lua: -------------------------------------------------------------------------------- 1 | solution "gluac" 2 | 3 | language "C" 4 | location ( os.get() .."-".. _ACTION ) 5 | flags { "Symbols", "NoEditAndContinue", "NoPCH", "StaticRuntime", "EnableSSE" } 6 | targetdir ( "bin/" .. os.get() .. "/" ) 7 | platforms{ "x32" } 8 | libdirs { "library/" .. os.get() } 9 | if os.get() == "linux" then 10 | links { "dl" } 11 | end 12 | 13 | configurations 14 | { 15 | "Release" 16 | } 17 | 18 | configuration "Release" 19 | if os.get() == "linux" then 20 | buildoptions { "-pthread -Wl,-z,defs" } 21 | end 22 | defines { "NDEBUG" } 23 | flags{ "Optimize", "FloatFast" } 24 | 25 | project "gluac" 26 | defines {} 27 | files { "src/**.*" } 28 | kind "ConsoleApp" -------------------------------------------------------------------------------- /src/lua_dyn.c: -------------------------------------------------------------------------------- 1 | #include "lua_dyn.h" 2 | #ifdef _WIN32 3 | #include 4 | #else 5 | #include 6 | #endif 7 | 8 | static const char* const FunctionNames[] = 9 | { 10 | "luaL_addlstring", 11 | "luaL_addstring", 12 | "luaL_addvalue", 13 | "luaL_argerror", 14 | "luaL_buffinit", 15 | "luaL_callmeta", 16 | "luaL_checkany", 17 | "luaL_checkinteger", 18 | "luaL_checklstring", 19 | "luaL_checknumber", 20 | "luaL_checkoption", 21 | "luaL_checkstack", 22 | "luaL_checktype", 23 | "luaL_checkudata", 24 | "luaL_error", 25 | "luaL_findtable", 26 | "luaL_getmetafield", 27 | "luaL_gsub", 28 | "luaL_loadbuffer", 29 | "luaL_loadbufferx", 30 | "luaL_loadfile", 31 | "luaL_loadfilex", 32 | "luaL_loadstring", 33 | "luaL_newmetatable", 34 | "luaL_newstate", 35 | "luaL_openlib", 36 | "luaL_openlibs", 37 | "luaL_optinteger", 38 | "luaL_optlstring", 39 | "luaL_optnumber", 40 | "luaL_prepbuffer", 41 | "luaL_pushresult", 42 | "luaL_ref", 43 | "luaL_register", 44 | "luaL_typerror", 45 | "luaL_unref", 46 | "luaL_where", 47 | "lua_atpanic", 48 | "lua_call", 49 | "lua_checkstack", 50 | "lua_close", 51 | "lua_concat", 52 | "lua_cpcall", 53 | "lua_createtable", 54 | "lua_dump", 55 | "lua_equal", 56 | "lua_error", 57 | "lua_gc", 58 | "lua_getallocf", 59 | "lua_getfenv", 60 | "lua_getfield", 61 | "lua_gethook", 62 | "lua_gethookcount", 63 | "lua_gethookmask", 64 | "lua_getinfo", 65 | "lua_getlocal", 66 | "lua_getmetatable", 67 | "lua_getstack", 68 | "lua_gettable", 69 | "lua_gettop", 70 | "lua_getupvalue", 71 | "lua_insert", 72 | "lua_iscfunction", 73 | "lua_isnumber", 74 | "lua_isstring", 75 | "lua_isuserdata", 76 | "lua_lessthan", 77 | "lua_load", 78 | "lua_loadx", 79 | "lua_newstate", 80 | "lua_newthread", 81 | "lua_newuserdata", 82 | "lua_next", 83 | "lua_objlen", 84 | "lua_pcall", 85 | "lua_pushboolean", 86 | "lua_pushcclosure", 87 | "lua_pushfstring", 88 | "lua_pushinteger", 89 | "lua_pushlightuserdata", 90 | "lua_pushlstring", 91 | "lua_pushnil", 92 | "lua_pushnumber", 93 | "lua_pushstring", 94 | "lua_pushthread", 95 | "lua_pushvalue", 96 | "lua_pushvfstring", 97 | "lua_rawequal", 98 | "lua_rawget", 99 | "lua_rawgeti", 100 | "lua_rawset", 101 | "lua_rawseti", 102 | "lua_remove", 103 | "lua_replace", 104 | "lua_resume_real", 105 | "lua_setallocf", 106 | "lua_setfenv", 107 | "lua_setfield", 108 | "lua_sethook", 109 | //"lua_setlevel", 110 | "lua_setlocal", 111 | "lua_setmetatable", 112 | "lua_settable", 113 | "lua_settop", 114 | "lua_setupvalue", 115 | "lua_status", 116 | "lua_toboolean", 117 | "lua_tocfunction", 118 | "lua_tointeger", 119 | "lua_tolstring", 120 | "lua_tonumber", 121 | "lua_topointer", 122 | "lua_tothread", 123 | "lua_touserdata", 124 | "lua_type", 125 | "lua_typename", 126 | "lua_upvalueid", 127 | "lua_upvaluejoin", 128 | "lua_xmove", 129 | "lua_yield", 130 | "luaopen_base", 131 | "luaopen_debug", 132 | //"luaopen_io", 133 | "luaopen_math", 134 | "luaopen_os", 135 | "luaopen_package", 136 | "luaopen_string", 137 | "luaopen_table", 138 | "luaopen_bit", 139 | "luaopen_jit", 140 | //"luaopen_ffi", 141 | }; 142 | 143 | int luaL_loadfunctions(void* hModule, struct lua_All_functions* functions, size_t size_struct) 144 | { 145 | int i; 146 | void** pfunctions = (void**)functions; 147 | 148 | if(sizeof(FunctionNames) != size_struct || hModule == NULL) 149 | return 0; 150 | 151 | for(i=0;i 4 | #else 5 | #include 6 | #endif 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define LUA_QL(x) "'" x "'" 14 | #define LUA_QS LUA_QL("%s") 15 | 16 | #define LUA_PREFIX LuaFunctions. 17 | lua_All_functions LuaFunctions; 18 | 19 | #define PROGNAME "gluac" /* default program name */ 20 | #define OUTPUT PROGNAME ".luac" /* default output file */ 21 | 22 | static int dumping=1; /* dump bytecodes? */ 23 | static char Output[]={ OUTPUT }; /* default output file name */ 24 | static const char* output=Output; /* actual output file name */ 25 | static const char* progname=PROGNAME; /* actual program name */ 26 | 27 | static void fatal(const char* message) 28 | { 29 | fprintf(stderr,"%s: %s\n",progname,message); 30 | exit(EXIT_FAILURE); 31 | } 32 | 33 | static void cannot(const char* what) 34 | { 35 | fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); 36 | exit(EXIT_FAILURE); 37 | } 38 | 39 | static void usage(const char* message) 40 | { 41 | if (*message=='-') 42 | fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); 43 | else 44 | fprintf(stderr,"%s: %s\n",progname,message); 45 | fprintf(stderr, 46 | "usage: %s [options] [filenames].\n" 47 | "Available options are:\n" 48 | " - process stdin\n" 49 | " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" 50 | " -p parse only\n" 51 | " -v show version information\n" 52 | " -- stop handling options\n", 53 | progname,Output); 54 | exit(EXIT_FAILURE); 55 | } 56 | 57 | #define IS(s) (strcmp(argv[i],s)==0) 58 | 59 | static int doargs(int argc, char* argv[]) 60 | { 61 | int i; 62 | int version=0; 63 | if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; 64 | for (i=1; idata), (*(wd->len)) + sz); 117 | 118 | if(newData) 119 | { 120 | memcpy(newData + (*(wd->len)), p, sz); 121 | *(wd->data) = newData; 122 | *(wd->len) += sz; 123 | } else { 124 | free(newData); 125 | return 1; 126 | } 127 | 128 | return 0; 129 | } 130 | 131 | static int pmain(lua_State* L) 132 | { 133 | struct Smain* s = (struct Smain*)lua_touserdata(L, 1); 134 | int argc=s->argc; 135 | char** argv=s->argv; 136 | int i; 137 | 138 | lua_pop(L,1); 139 | 140 | if (!lua_checkstack(L,argc)) fatal("too many input files"); 141 | for (i=0; i 0 ? "ab" : "wb")); 149 | if (D==NULL) cannot("open"); 150 | 151 | char* bytecode = 0L; 152 | size_t len = 0; 153 | wdata wd = {&len, &bytecode}; 154 | 155 | if(lua_dump(L, write_dump, &wd)) fatal("failed to dump bytecode"); 156 | 157 | fwrite(bytecode,len,1,D); 158 | 159 | lua_pop(L,3); 160 | 161 | if (ferror(D)) cannot("write"); 162 | if (fclose(D)) cannot("close"); 163 | } 164 | 165 | } 166 | return 0; 167 | } 168 | 169 | int glua_print(lua_State* L) 170 | { 171 | int i; 172 | for (i=1; i <= lua_gettop(L); i++) { 173 | if (i>1) 174 | printf("\t"); 175 | 176 | lua_getglobal(L, "tostring"); 177 | lua_pushvalue(L, i); 178 | lua_call(L, 1, 1); 179 | 180 | printf("%s", lua_tostring(L,-1)); 181 | 182 | lua_pop(L,1); 183 | } 184 | printf("\n"); 185 | return 0; 186 | } 187 | 188 | int main(int argc, char* argv[]) 189 | { 190 | #ifdef _WIN32 191 | HMODULE module = LoadLibrary("lua_shared.dll"); 192 | #else 193 | void* module = dlopen("lua_shared.so", RTLD_LAZY); 194 | #endif 195 | if(!luaL_loadfunctions(module, &LuaFunctions, sizeof(LuaFunctions))) 196 | { 197 | printf("Error loading lua_shared\n"); 198 | return 1; 199 | } 200 | 201 | { 202 | lua_State* L; 203 | struct Smain s; 204 | int i=doargs(argc,argv); 205 | argc-=i; argv+=i; 206 | if (argc<=0) usage("no input files given"); 207 | L=lua_open(); 208 | luaL_openlibs(L); 209 | //lua_register(L, "print", glua_print); 210 | if (L==NULL) fatal("not enough memory for state"); 211 | s.argc=argc; 212 | s.argv=argv; 213 | if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1)); 214 | lua_close(L); 215 | } 216 | return EXIT_SUCCESS; 217 | } -------------------------------------------------------------------------------- /src/lua_dyn.h: -------------------------------------------------------------------------------- 1 | /* Lua language header file, designed for dynamic DLL loading. 2 | This file is not part of the standard distribution, but was 3 | generated from original files /usr/local/include/luajit-2.0/lua.h, /usr/local/include/luajit-2.0/lauxlib.h, /usr/local/include/luajit-2.0/lualib.h */ 4 | 5 | #ifndef LUA_DYNAMIC_H 6 | #define LUA_DYNAMIC_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | #ifndef _WIN32 12 | #define __cdecl 13 | #define GetProcAddress dlsym 14 | #endif 15 | 16 | #define LUA_COMPAT_OPENLIB 17 | #define LUA_INTEGER ptrdiff_t 18 | #define LUAL_BUFFERSIZE BUFSIZ 19 | #define LUA_IDSIZE 60 20 | #define LUA_NUMBER double 21 | 22 | /****************************************************************************** 23 | * Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. 24 | * 25 | * Permission is hereby granted, free of charge, to any person obtaining 26 | * a copy of this software and associated documentation files (the 27 | * "Software"), to deal in the Software without restriction, including 28 | * without limitation the rights to use, copy, modify, merge, publish, 29 | * distribute, sublicense, and/or sell copies of the Software, and to 30 | * permit persons to whom the Software is furnished to do so, subject to 31 | * the following conditions: 32 | * 33 | * The above copyright notice and this permission notice shall be 34 | * included in all copies or substantial portions of the Software. 35 | * 36 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 37 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 38 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 39 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 40 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 41 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 42 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | ******************************************************************************/ 44 | 45 | #include 46 | #include 47 | 48 | #define LUA_VERSION "Lua 5.1" 49 | #define LUA_RELEASE "Lua 5.1.4" 50 | #define LUA_VERSION_NUM 501 51 | #define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" 52 | #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" 53 | 54 | #define LUA_SIGNATURE "\033Lua" 55 | 56 | #define LUA_MULTRET (-1) 57 | 58 | #define LUA_REGISTRYINDEX (-10000) 59 | #define LUA_ENVIRONINDEX (-10001) 60 | #define LUA_GLOBALSINDEX (-10002) 61 | #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) 62 | 63 | #define LUA_YIELD 1 64 | #define LUA_ERRRUN 2 65 | #define LUA_ERRSYNTAX 3 66 | #define LUA_ERRMEM 4 67 | #define LUA_ERRERR 5 68 | 69 | typedef struct lua_State lua_State; 70 | 71 | typedef int (*lua_CFunction) (lua_State *L); 72 | 73 | typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); 74 | 75 | typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); 76 | 77 | typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); 78 | 79 | #define LUA_TNONE (-1) 80 | 81 | #define LUA_TNIL 0 82 | #define LUA_TBOOLEAN 1 83 | #define LUA_TLIGHTUSERDATA 2 84 | #define LUA_TNUMBER 3 85 | #define LUA_TSTRING 4 86 | #define LUA_TTABLE 5 87 | #define LUA_TFUNCTION 6 88 | #define LUA_TUSERDATA 7 89 | #define LUA_TTHREAD 8 90 | 91 | #define LUA_MINSTACK 20 92 | 93 | typedef LUA_NUMBER lua_Number; 94 | 95 | typedef LUA_INTEGER lua_Integer; 96 | 97 | typedef lua_State * (__cdecl *lua_newstate_t) (lua_Alloc f, void *ud); 98 | typedef void (__cdecl *lua_close_t) (lua_State *L); 99 | typedef lua_State * (__cdecl *lua_newthread_t) (lua_State *L); 100 | 101 | typedef lua_CFunction (__cdecl *lua_atpanic_t) (lua_State *L, lua_CFunction panicf); 102 | 103 | typedef int (__cdecl *lua_gettop_t) (lua_State *L); 104 | typedef void (__cdecl *lua_settop_t) (lua_State *L, int idx); 105 | typedef void (__cdecl *lua_pushvalue_t) (lua_State *L, int idx); 106 | typedef void (__cdecl *lua_remove_t) (lua_State *L, int idx); 107 | typedef void (__cdecl *lua_insert_t) (lua_State *L, int idx); 108 | typedef void (__cdecl *lua_replace_t) (lua_State *L, int idx); 109 | typedef int (__cdecl *lua_checkstack_t) (lua_State *L, int sz); 110 | 111 | typedef void (__cdecl *lua_xmove_t) (lua_State *from, lua_State *to, int n); 112 | 113 | typedef int (__cdecl *lua_isnumber_t) (lua_State *L, int idx); 114 | typedef int (__cdecl *lua_isstring_t) (lua_State *L, int idx); 115 | typedef int (__cdecl *lua_iscfunction_t) (lua_State *L, int idx); 116 | typedef int (__cdecl *lua_isuserdata_t) (lua_State *L, int idx); 117 | typedef int (__cdecl *lua_type_t) (lua_State *L, int idx); 118 | typedef const char * (__cdecl *lua_typename_t) (lua_State *L, int tp); 119 | 120 | typedef int (__cdecl *lua_equal_t) (lua_State *L, int idx1, int idx2); 121 | typedef int (__cdecl *lua_rawequal_t) (lua_State *L, int idx1, int idx2); 122 | typedef int (__cdecl *lua_lessthan_t) (lua_State *L, int idx1, int idx2); 123 | 124 | typedef lua_Number (__cdecl *lua_tonumber_t) (lua_State *L, int idx); 125 | typedef lua_Integer (__cdecl *lua_tointeger_t) (lua_State *L, int idx); 126 | typedef int (__cdecl *lua_toboolean_t) (lua_State *L, int idx); 127 | typedef const char * (__cdecl *lua_tolstring_t) (lua_State *L, int idx, size_t *len); 128 | typedef size_t (__cdecl *lua_objlen_t) (lua_State *L, int idx); 129 | typedef lua_CFunction (__cdecl *lua_tocfunction_t) (lua_State *L, int idx); 130 | typedef void * (__cdecl *lua_touserdata_t) (lua_State *L, int idx); 131 | typedef lua_State * (__cdecl *lua_tothread_t) (lua_State *L, int idx); 132 | typedef const void * (__cdecl *lua_topointer_t) (lua_State *L, int idx); 133 | 134 | typedef void (__cdecl *lua_pushnil_t) (lua_State *L); 135 | typedef void (__cdecl *lua_pushnumber_t) (lua_State *L, lua_Number n); 136 | typedef void (__cdecl *lua_pushinteger_t) (lua_State *L, lua_Integer n); 137 | typedef void (__cdecl *lua_pushlstring_t) (lua_State *L, const char *s, size_t l); 138 | typedef void (__cdecl *lua_pushstring_t) (lua_State *L, const char *s); 139 | typedef const char * (__cdecl *lua_pushvfstring_t) (lua_State *L, const char *fmt, 140 | va_list argp); 141 | typedef const char * (__cdecl *lua_pushfstring_t) (lua_State *L, const char *fmt, ...); 142 | typedef void (__cdecl *lua_pushcclosure_t) (lua_State *L, lua_CFunction fn, int n); 143 | typedef void (__cdecl *lua_pushboolean_t) (lua_State *L, int b); 144 | typedef void (__cdecl *lua_pushlightuserdata_t) (lua_State *L, void *p); 145 | typedef int (__cdecl *lua_pushthread_t) (lua_State *L); 146 | 147 | typedef void (__cdecl *lua_gettable_t) (lua_State *L, int idx); 148 | typedef void (__cdecl *lua_getfield_t) (lua_State *L, int idx, const char *k); 149 | typedef void (__cdecl *lua_rawget_t) (lua_State *L, int idx); 150 | typedef void (__cdecl *lua_rawgeti_t) (lua_State *L, int idx, int n); 151 | typedef void (__cdecl *lua_createtable_t) (lua_State *L, int narr, int nrec); 152 | typedef void * (__cdecl *lua_newuserdata_t) (lua_State *L, size_t sz); 153 | typedef int (__cdecl *lua_getmetatable_t) (lua_State *L, int objindex); 154 | typedef void (__cdecl *lua_getfenv_t) (lua_State *L, int idx); 155 | 156 | typedef void (__cdecl *lua_settable_t) (lua_State *L, int idx); 157 | typedef void (__cdecl *lua_setfield_t) (lua_State *L, int idx, const char *k); 158 | typedef void (__cdecl *lua_rawset_t) (lua_State *L, int idx); 159 | typedef void (__cdecl *lua_rawseti_t) (lua_State *L, int idx, int n); 160 | typedef int (__cdecl *lua_setmetatable_t) (lua_State *L, int objindex); 161 | typedef int (__cdecl *lua_setfenv_t) (lua_State *L, int idx); 162 | 163 | typedef void (__cdecl *lua_call_t) (lua_State *L, int nargs, int nresults); 164 | typedef int (__cdecl *lua_pcall_t) (lua_State *L, int nargs, int nresults, int errfunc); 165 | typedef int (__cdecl *lua_cpcall_t) (lua_State *L, lua_CFunction func, void *ud); 166 | typedef int (__cdecl *lua_load_t) (lua_State *L, lua_Reader reader, void *dt, 167 | const char *chunkname); 168 | 169 | typedef int (__cdecl *lua_dump_t) (lua_State *L, lua_Writer writer, void *data); 170 | 171 | typedef int (__cdecl *lua_yield_t) (lua_State *L, int nresults); 172 | typedef int (__cdecl *lua_resume_t) (lua_State *L, int narg); 173 | typedef int (__cdecl *lua_status_t) (lua_State *L); 174 | 175 | #define LUA_GCSTOP 0 176 | #define LUA_GCRESTART 1 177 | #define LUA_GCCOLLECT 2 178 | #define LUA_GCCOUNT 3 179 | #define LUA_GCCOUNTB 4 180 | #define LUA_GCSTEP 5 181 | #define LUA_GCSETPAUSE 6 182 | #define LUA_GCSETSTEPMUL 7 183 | 184 | typedef int (__cdecl *lua_gc_t) (lua_State *L, int what, int data); 185 | 186 | typedef int (__cdecl *lua_error_t) (lua_State *L); 187 | 188 | typedef int (__cdecl *lua_next_t) (lua_State *L, int idx); 189 | 190 | typedef void (__cdecl *lua_concat_t) (lua_State *L, int n); 191 | 192 | typedef lua_Alloc (__cdecl *lua_getallocf_t) (lua_State *L, void **ud); 193 | typedef void (__cdecl *lua_setallocf_t) (lua_State *L, lua_Alloc f, void *ud); 194 | 195 | #define lua_pop(L,n) lua_settop(L, -(n)-1) 196 | 197 | #define lua_newtable(L) lua_createtable(L, 0, 0) 198 | 199 | #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) 200 | 201 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) 202 | 203 | #define lua_strlen(L,i) lua_objlen(L, (i)) 204 | 205 | #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) 206 | #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) 207 | #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) 208 | #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) 209 | #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) 210 | #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) 211 | #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) 212 | #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) 213 | 214 | #define lua_pushliteral(L, s) \ 215 | lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) 216 | 217 | #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) 218 | #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) 219 | 220 | #define lua_tostring(L,i) lua_tolstring(L, (i), NULL) 221 | 222 | #define lua_open() luaL_newstate() 223 | 224 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) 225 | 226 | #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) 227 | 228 | #define lua_Chunkreader lua_Reader 229 | #define lua_Chunkwriter lua_Writer 230 | 231 | typedef void (__cdecl *lua_setlevel_t) (lua_State *from, lua_State *to); 232 | 233 | #define LUA_HOOKCALL 0 234 | #define LUA_HOOKRET 1 235 | #define LUA_HOOKLINE 2 236 | #define LUA_HOOKCOUNT 3 237 | #define LUA_HOOKTAILRET 4 238 | 239 | #define LUA_MASKCALL (1 << LUA_HOOKCALL) 240 | #define LUA_MASKRET (1 << LUA_HOOKRET) 241 | #define LUA_MASKLINE (1 << LUA_HOOKLINE) 242 | #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) 243 | 244 | typedef struct lua_Debug lua_Debug; 245 | 246 | typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); 247 | 248 | typedef int (__cdecl *lua_getstack_t) (lua_State *L, int level, lua_Debug *ar); 249 | typedef int (__cdecl *lua_getinfo_t) (lua_State *L, const char *what, lua_Debug *ar); 250 | typedef const char * (__cdecl *lua_getlocal_t) (lua_State *L, const lua_Debug *ar, int n); 251 | typedef const char * (__cdecl *lua_setlocal_t) (lua_State *L, const lua_Debug *ar, int n); 252 | typedef const char * (__cdecl *lua_getupvalue_t) (lua_State *L, int funcindex, int n); 253 | typedef const char * (__cdecl *lua_setupvalue_t) (lua_State *L, int funcindex, int n); 254 | typedef int (__cdecl *lua_sethook_t) (lua_State *L, lua_Hook func, int mask, int count); 255 | typedef lua_Hook (__cdecl *lua_gethook_t) (lua_State *L); 256 | typedef int (__cdecl *lua_gethookmask_t) (lua_State *L); 257 | typedef int (__cdecl *lua_gethookcount_t) (lua_State *L); 258 | 259 | typedef void * (__cdecl *lua_upvalueid_t) (lua_State *L, int idx, int n); 260 | typedef void (__cdecl *lua_upvaluejoin_t) (lua_State *L, int idx1, int n1, int idx2, int n2); 261 | typedef int (__cdecl *lua_loadx_t) (lua_State *L, lua_Reader reader, void *dt, 262 | const char *chunkname, const char *mode); 263 | 264 | struct lua_Debug { 265 | int event; 266 | const char *name; 267 | const char *namewhat; 268 | const char *what; 269 | const char *source; 270 | int currentline; 271 | int nups; 272 | int linedefined; 273 | int lastlinedefined; 274 | char short_src[LUA_IDSIZE]; 275 | 276 | int i_ci; 277 | }; 278 | 279 | 280 | 281 | #include 282 | #include 283 | 284 | #define luaL_getn(L,i) ((int)lua_objlen(L, i)) 285 | #define luaL_setn(L,i,j) ((void)0) 286 | 287 | #define LUA_ERRFILE (LUA_ERRERR+1) 288 | 289 | typedef struct luaL_Reg { 290 | const char *name; 291 | lua_CFunction func; 292 | } luaL_Reg; 293 | 294 | typedef void (__cdecl *luaL_openlib_t) (lua_State *L, const char *libname, 295 | const luaL_Reg *l, int nup); 296 | typedef void (__cdecl *luaL_register_t) (lua_State *L, const char *libname, 297 | const luaL_Reg *l); 298 | typedef int (__cdecl *luaL_getmetafield_t) (lua_State *L, int obj, const char *e); 299 | typedef int (__cdecl *luaL_callmeta_t) (lua_State *L, int obj, const char *e); 300 | typedef int (__cdecl *luaL_typerror_t) (lua_State *L, int narg, const char *tname); 301 | typedef int (__cdecl *luaL_argerror_t) (lua_State *L, int numarg, const char *extramsg); 302 | typedef const char * (__cdecl *luaL_checklstring_t) (lua_State *L, int numArg, 303 | size_t *l); 304 | typedef const char * (__cdecl *luaL_optlstring_t) (lua_State *L, int numArg, 305 | const char *def, size_t *l); 306 | typedef lua_Number (__cdecl *luaL_checknumber_t) (lua_State *L, int numArg); 307 | typedef lua_Number (__cdecl *luaL_optnumber_t) (lua_State *L, int nArg, lua_Number def); 308 | 309 | typedef lua_Integer (__cdecl *luaL_checkinteger_t) (lua_State *L, int numArg); 310 | typedef lua_Integer (__cdecl *luaL_optinteger_t) (lua_State *L, int nArg, 311 | lua_Integer def); 312 | 313 | typedef void (__cdecl *luaL_checkstack_t) (lua_State *L, int sz, const char *msg); 314 | typedef void (__cdecl *luaL_checktype_t) (lua_State *L, int narg, int t); 315 | typedef void (__cdecl *luaL_checkany_t) (lua_State *L, int narg); 316 | 317 | typedef int (__cdecl *luaL_newmetatable_t) (lua_State *L, const char *tname); 318 | typedef void * (__cdecl *luaL_checkudata_t) (lua_State *L, int ud, const char *tname); 319 | 320 | typedef void (__cdecl *luaL_where_t) (lua_State *L, int lvl); 321 | typedef int (__cdecl *luaL_error_t) (lua_State *L, const char *fmt, ...); 322 | 323 | typedef int (__cdecl *luaL_checkoption_t) (lua_State *L, int narg, const char *def, 324 | const char *const lst[]); 325 | 326 | typedef int (__cdecl *luaL_ref_t) (lua_State *L, int t); 327 | typedef void (__cdecl *luaL_unref_t) (lua_State *L, int t, int ref); 328 | 329 | typedef int (__cdecl *luaL_loadfile_t) (lua_State *L, const char *filename); 330 | typedef int (__cdecl *luaL_loadbuffer_t) (lua_State *L, const char *buff, size_t sz, 331 | const char *name); 332 | typedef int (__cdecl *luaL_loadstring_t) (lua_State *L, const char *s); 333 | 334 | typedef lua_State * (__cdecl *luaL_newstate_t) (void); 335 | 336 | typedef const char * (__cdecl *luaL_gsub_t) (lua_State *L, const char *s, const char *p, 337 | const char *r); 338 | 339 | typedef const char * (__cdecl *luaL_findtable_t) (lua_State *L, int idx, 340 | const char *fname, int szhint); 341 | 342 | typedef int luaL_fileresult(lua_State *L, int stat, const char *fname); 343 | typedef int luaL_execresult(lua_State *L, int stat); 344 | 345 | typedef int (__cdecl *luaL_loadfilex_t) (lua_State *L, const char *filename, 346 | const char *mode); 347 | typedef int (__cdecl *luaL_loadbufferx_t) (lua_State *L, const char *buff, size_t sz, 348 | const char *name, const char *mode); 349 | typedef void luaL_traceback (lua_State *L, lua_State *L1, const char *msg, 350 | int level); 351 | 352 | #define luaL_argcheck(L, cond,numarg,extramsg) \ 353 | ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) 354 | #define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) 355 | #define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) 356 | #define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) 357 | #define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) 358 | #define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) 359 | #define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) 360 | 361 | #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) 362 | 363 | #define luaL_dofile(L, fn) \ 364 | (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) 365 | 366 | #define luaL_dostring(L, s) \ 367 | (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) 368 | 369 | #define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) 370 | 371 | #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) 372 | 373 | typedef struct luaL_Buffer { 374 | char *p; 375 | int lvl; 376 | lua_State *L; 377 | char buffer[LUAL_BUFFERSIZE]; 378 | } luaL_Buffer; 379 | 380 | #define luaL_addchar(B,c) \ 381 | ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ 382 | (*(B)->p++ = (char)(c))) 383 | 384 | #define luaL_putchar(B,c) luaL_addchar(B,c) 385 | 386 | #define luaL_addsize(B,n) ((B)->p += (n)) 387 | 388 | typedef void (__cdecl *luaL_buffinit_t) (lua_State *L, luaL_Buffer *B); 389 | typedef char * (__cdecl *luaL_prepbuffer_t) (luaL_Buffer *B); 390 | typedef void (__cdecl *luaL_addlstring_t) (luaL_Buffer *B, const char *s, size_t l); 391 | typedef void (__cdecl *luaL_addstring_t) (luaL_Buffer *B, const char *s); 392 | typedef void (__cdecl *luaL_addvalue_t) (luaL_Buffer *B); 393 | typedef void (__cdecl *luaL_pushresult_t) (luaL_Buffer *B); 394 | 395 | #define LUA_NOREF (-2) 396 | #define LUA_REFNIL (-1) 397 | 398 | #define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ 399 | (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) 400 | 401 | #define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) 402 | 403 | #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) 404 | 405 | #define luaL_reg luaL_Reg 406 | 407 | 408 | 409 | #define LUA_FILEHANDLE "FILE*" 410 | 411 | #define LUA_COLIBNAME "coroutine" 412 | #define LUA_MATHLIBNAME "math" 413 | #define LUA_STRLIBNAME "string" 414 | #define LUA_TABLIBNAME "table" 415 | #define LUA_IOLIBNAME "io" 416 | #define LUA_OSLIBNAME "os" 417 | #define LUA_LOADLIBNAME "package" 418 | #define LUA_DBLIBNAME "debug" 419 | #define LUA_BITLIBNAME "bit" 420 | #define LUA_JITLIBNAME "jit" 421 | #define LUA_FFILIBNAME "ffi" 422 | 423 | typedef int (__cdecl *luaopen_base_t) (lua_State *L); 424 | typedef int (__cdecl *luaopen_math_t) (lua_State *L); 425 | typedef int (__cdecl *luaopen_string_t) (lua_State *L); 426 | typedef int (__cdecl *luaopen_table_t) (lua_State *L); 427 | typedef int (__cdecl *luaopen_io_t) (lua_State *L); 428 | typedef int (__cdecl *luaopen_os_t) (lua_State *L); 429 | typedef int (__cdecl *luaopen_package_t) (lua_State *L); 430 | typedef int (__cdecl *luaopen_debug_t) (lua_State *L); 431 | typedef int (__cdecl *luaopen_bit_t) (lua_State *L); 432 | typedef int (__cdecl *luaopen_jit_t) (lua_State *L); 433 | typedef int (__cdecl *luaopen_ffi_t) (lua_State *L); 434 | 435 | typedef void (__cdecl *luaL_openlibs_t) (lua_State *L); 436 | 437 | #define luaL_addlstring LUA_PREFIX AddlstringL 438 | #define luaL_addstring LUA_PREFIX AddstringL 439 | #define luaL_addvalue LUA_PREFIX AddvalueL 440 | #define luaL_argerror LUA_PREFIX ArgerrorL 441 | #define luaL_buffinit LUA_PREFIX BuffinitL 442 | #define luaL_callmeta LUA_PREFIX CallmetaL 443 | #define luaL_checkany LUA_PREFIX CheckanyL 444 | #define luaL_checkinteger LUA_PREFIX CheckintegerL 445 | #define luaL_checklstring LUA_PREFIX ChecklstringL 446 | #define luaL_checknumber LUA_PREFIX ChecknumberL 447 | #define luaL_checkoption LUA_PREFIX CheckoptionL 448 | #define luaL_checkstack LUA_PREFIX CheckstackL 449 | #define luaL_checktype LUA_PREFIX ChecktypeL 450 | #define luaL_checkudata LUA_PREFIX CheckudataL 451 | #define luaL_error LUA_PREFIX ErrorL 452 | #define luaL_findtable LUA_PREFIX FindtableL 453 | #define luaL_getmetafield LUA_PREFIX GetmetafieldL 454 | #define luaL_gsub LUA_PREFIX GsubL 455 | #define luaL_loadbuffer LUA_PREFIX LoadbufferL 456 | #define luaL_loadbufferx LUA_PREFIX LoadbufferxL 457 | #define luaL_loadfile LUA_PREFIX LoadfileL 458 | #define luaL_loadfilex LUA_PREFIX LoadfilexL 459 | #define luaL_loadstring LUA_PREFIX LoadstringL 460 | #define luaL_newmetatable LUA_PREFIX NewmetatableL 461 | #define luaL_newstate LUA_PREFIX NewstateL 462 | #define luaL_openlib LUA_PREFIX OpenlibL 463 | #define luaL_openlibs LUA_PREFIX OpenlibsL 464 | #define luaL_optinteger LUA_PREFIX OptintegerL 465 | #define luaL_optlstring LUA_PREFIX OptlstringL 466 | #define luaL_optnumber LUA_PREFIX OptnumberL 467 | #define luaL_prepbuffer LUA_PREFIX PrepbufferL 468 | #define luaL_pushresult LUA_PREFIX PushresultL 469 | #define luaL_ref LUA_PREFIX RefL 470 | #define luaL_register LUA_PREFIX RegisterL 471 | #define luaL_typerror LUA_PREFIX TyperrorL 472 | #define luaL_unref LUA_PREFIX UnrefL 473 | #define luaL_where LUA_PREFIX WhereL 474 | #define lua_atpanic LUA_PREFIX Atpanic 475 | #define lua_call LUA_PREFIX Call 476 | #define lua_checkstack LUA_PREFIX Checkstack 477 | #define lua_close LUA_PREFIX Close 478 | #define lua_concat LUA_PREFIX Concat 479 | #define lua_cpcall LUA_PREFIX Cpcall 480 | #define lua_createtable LUA_PREFIX Createtable 481 | #define lua_dump LUA_PREFIX Dump 482 | #define lua_equal LUA_PREFIX Equal 483 | #define lua_error LUA_PREFIX Error 484 | #define lua_gc LUA_PREFIX Gc 485 | #define lua_getallocf LUA_PREFIX Getallocf 486 | #define lua_getfenv LUA_PREFIX Getfenv 487 | #define lua_getfield LUA_PREFIX Getfield 488 | #define lua_gethook LUA_PREFIX Gethook 489 | #define lua_gethookcount LUA_PREFIX Gethookcount 490 | #define lua_gethookmask LUA_PREFIX Gethookmask 491 | #define lua_getinfo LUA_PREFIX Getinfo 492 | #define lua_getlocal LUA_PREFIX Getlocal 493 | #define lua_getmetatable LUA_PREFIX Getmetatable 494 | #define lua_getstack LUA_PREFIX Getstack 495 | #define lua_gettable LUA_PREFIX Gettable 496 | #define lua_gettop LUA_PREFIX Gettop 497 | #define lua_getupvalue LUA_PREFIX Getupvalue 498 | #define lua_insert LUA_PREFIX Insert 499 | #define lua_iscfunction LUA_PREFIX Iscfunction 500 | #define lua_isnumber LUA_PREFIX Isnumber 501 | #define lua_isstring LUA_PREFIX Isstring 502 | #define lua_isuserdata LUA_PREFIX Isuserdata 503 | #define lua_lessthan LUA_PREFIX Lessthan 504 | #define lua_load LUA_PREFIX Load 505 | #define lua_loadx LUA_PREFIX Loadx 506 | #define lua_newstate LUA_PREFIX Newstate 507 | #define lua_newthread LUA_PREFIX Newthread 508 | #define lua_newuserdata LUA_PREFIX Newuserdata 509 | #define lua_next LUA_PREFIX Next 510 | #define lua_objlen LUA_PREFIX Objlen 511 | #define lua_pcall LUA_PREFIX Pcall 512 | #define lua_pushboolean LUA_PREFIX Pushboolean 513 | #define lua_pushcclosure LUA_PREFIX Pushcclosure 514 | #define lua_pushfstring LUA_PREFIX Pushfstring 515 | #define lua_pushinteger LUA_PREFIX Pushinteger 516 | #define lua_pushlightuserdata LUA_PREFIX Pushlightuserdata 517 | #define lua_pushlstring LUA_PREFIX Pushlstring 518 | #define lua_pushnil LUA_PREFIX Pushnil 519 | #define lua_pushnumber LUA_PREFIX Pushnumber 520 | #define lua_pushstring LUA_PREFIX Pushstring 521 | #define lua_pushthread LUA_PREFIX Pushthread 522 | #define lua_pushvalue LUA_PREFIX Pushvalue 523 | #define lua_pushvfstring LUA_PREFIX Pushvfstring 524 | #define lua_rawequal LUA_PREFIX Rawequal 525 | #define lua_rawget LUA_PREFIX Rawget 526 | #define lua_rawgeti LUA_PREFIX Rawgeti 527 | #define lua_rawset LUA_PREFIX Rawset 528 | #define lua_rawseti LUA_PREFIX Rawseti 529 | #define lua_remove LUA_PREFIX Remove 530 | #define lua_replace LUA_PREFIX Replace 531 | #define lua_resume LUA_PREFIX Resume 532 | #define lua_setallocf LUA_PREFIX Setallocf 533 | #define lua_setfenv LUA_PREFIX Setfenv 534 | #define lua_setfield LUA_PREFIX Setfield 535 | #define lua_sethook LUA_PREFIX Sethook 536 | //#define lua_setlevel LUA_PREFIX Setlevel 537 | #define lua_setlocal LUA_PREFIX Setlocal 538 | #define lua_setmetatable LUA_PREFIX Setmetatable 539 | #define lua_settable LUA_PREFIX Settable 540 | #define lua_settop LUA_PREFIX Settop 541 | #define lua_setupvalue LUA_PREFIX Setupvalue 542 | #define lua_status LUA_PREFIX Status 543 | #define lua_toboolean LUA_PREFIX Toboolean 544 | #define lua_tocfunction LUA_PREFIX Tocfunction 545 | #define lua_tointeger LUA_PREFIX Tointeger 546 | #define lua_tolstring LUA_PREFIX Tolstring 547 | #define lua_tonumber LUA_PREFIX Tonumber 548 | #define lua_topointer LUA_PREFIX Topointer 549 | #define lua_tothread LUA_PREFIX Tothread 550 | #define lua_touserdata LUA_PREFIX Touserdata 551 | #define lua_type LUA_PREFIX Type 552 | #define lua_typename LUA_PREFIX Typename 553 | #define lua_upvalueid LUA_PREFIX Upvalueid 554 | #define lua_upvaluejoin LUA_PREFIX Upvaluejoin 555 | #define lua_xmove LUA_PREFIX Xmove 556 | #define lua_yield LUA_PREFIX Yield 557 | #define luaopen_base LUA_PREFIX Open_base 558 | #define luaopen_debug LUA_PREFIX Open_debug 559 | #define luaopen_io LUA_PREFIX Open_io 560 | #define luaopen_math LUA_PREFIX Open_math 561 | #define luaopen_os LUA_PREFIX Open_os 562 | #define luaopen_package LUA_PREFIX Open_package 563 | #define luaopen_string LUA_PREFIX Open_string 564 | #define luaopen_table LUA_PREFIX Open_table 565 | #define luaopen_bit LUA_PREFIX Open_bit 566 | #define luaopen_jit LUA_PREFIX Open_jit 567 | #define luaopen_ffi LUA_PREFIX Open_ffi 568 | 569 | typedef struct lua_All_functions 570 | { 571 | luaL_addlstring_t AddlstringL; 572 | luaL_addstring_t AddstringL; 573 | luaL_addvalue_t AddvalueL; 574 | luaL_argerror_t ArgerrorL; 575 | luaL_buffinit_t BuffinitL; 576 | luaL_callmeta_t CallmetaL; 577 | luaL_checkany_t CheckanyL; 578 | luaL_checkinteger_t CheckintegerL; 579 | luaL_checklstring_t ChecklstringL; 580 | luaL_checknumber_t ChecknumberL; 581 | luaL_checkoption_t CheckoptionL; 582 | luaL_checkstack_t CheckstackL; 583 | luaL_checktype_t ChecktypeL; 584 | luaL_checkudata_t CheckudataL; 585 | luaL_error_t ErrorL; 586 | luaL_findtable_t FindtableL; 587 | luaL_getmetafield_t GetmetafieldL; 588 | luaL_gsub_t GsubL; 589 | luaL_loadbuffer_t LoadbufferL; 590 | luaL_loadbufferx_t LoadbufferxL; 591 | luaL_loadfile_t LoadfileL; 592 | luaL_loadfilex_t LoadfilexL; 593 | luaL_loadstring_t LoadstringL; 594 | luaL_newmetatable_t NewmetatableL; 595 | luaL_newstate_t NewstateL; 596 | luaL_openlib_t OpenlibL; 597 | luaL_openlibs_t OpenlibsL; 598 | luaL_optinteger_t OptintegerL; 599 | luaL_optlstring_t OptlstringL; 600 | luaL_optnumber_t OptnumberL; 601 | luaL_prepbuffer_t PrepbufferL; 602 | luaL_pushresult_t PushresultL; 603 | luaL_ref_t RefL; 604 | luaL_register_t RegisterL; 605 | luaL_typerror_t TyperrorL; 606 | luaL_unref_t UnrefL; 607 | luaL_where_t WhereL; 608 | lua_atpanic_t Atpanic; 609 | lua_call_t Call; 610 | lua_checkstack_t Checkstack; 611 | lua_close_t Close; 612 | lua_concat_t Concat; 613 | lua_cpcall_t Cpcall; 614 | lua_createtable_t Createtable; 615 | lua_dump_t Dump; 616 | lua_equal_t Equal; 617 | lua_error_t Error; 618 | lua_gc_t Gc; 619 | lua_getallocf_t Getallocf; 620 | lua_getfenv_t Getfenv; 621 | lua_getfield_t Getfield; 622 | lua_gethook_t Gethook; 623 | lua_gethookcount_t Gethookcount; 624 | lua_gethookmask_t Gethookmask; 625 | lua_getinfo_t Getinfo; 626 | lua_getlocal_t Getlocal; 627 | lua_getmetatable_t Getmetatable; 628 | lua_getstack_t Getstack; 629 | lua_gettable_t Gettable; 630 | lua_gettop_t Gettop; 631 | lua_getupvalue_t Getupvalue; 632 | lua_insert_t Insert; 633 | lua_iscfunction_t Iscfunction; 634 | lua_isnumber_t Isnumber; 635 | lua_isstring_t Isstring; 636 | lua_isuserdata_t Isuserdata; 637 | lua_lessthan_t Lessthan; 638 | lua_load_t Load; 639 | lua_loadx_t Loadx; 640 | lua_newstate_t Newstate; 641 | lua_newthread_t Newthread; 642 | lua_newuserdata_t Newuserdata; 643 | lua_next_t Next; 644 | lua_objlen_t Objlen; 645 | lua_pcall_t Pcall; 646 | lua_pushboolean_t Pushboolean; 647 | lua_pushcclosure_t Pushcclosure; 648 | lua_pushfstring_t Pushfstring; 649 | lua_pushinteger_t Pushinteger; 650 | lua_pushlightuserdata_t Pushlightuserdata; 651 | lua_pushlstring_t Pushlstring; 652 | lua_pushnil_t Pushnil; 653 | lua_pushnumber_t Pushnumber; 654 | lua_pushstring_t Pushstring; 655 | lua_pushthread_t Pushthread; 656 | lua_pushvalue_t Pushvalue; 657 | lua_pushvfstring_t Pushvfstring; 658 | lua_rawequal_t Rawequal; 659 | lua_rawget_t Rawget; 660 | lua_rawgeti_t Rawgeti; 661 | lua_rawset_t Rawset; 662 | lua_rawseti_t Rawseti; 663 | lua_remove_t Remove; 664 | lua_replace_t Replace; 665 | lua_resume_t Resume; 666 | lua_setallocf_t Setallocf; 667 | lua_setfenv_t Setfenv; 668 | lua_setfield_t Setfield; 669 | lua_sethook_t Sethook; 670 | //lua_setlevel_t Setlevel; 671 | lua_setlocal_t Setlocal; 672 | lua_setmetatable_t Setmetatable; 673 | lua_settable_t Settable; 674 | lua_settop_t Settop; 675 | lua_setupvalue_t Setupvalue; 676 | lua_status_t Status; 677 | lua_toboolean_t Toboolean; 678 | lua_tocfunction_t Tocfunction; 679 | lua_tointeger_t Tointeger; 680 | lua_tolstring_t Tolstring; 681 | lua_tonumber_t Tonumber; 682 | lua_topointer_t Topointer; 683 | lua_tothread_t Tothread; 684 | lua_touserdata_t Touserdata; 685 | lua_type_t Type; 686 | lua_typename_t Typename; 687 | lua_upvalueid_t Upvalueid; 688 | lua_upvaluejoin_t Upvaluejoin; 689 | lua_xmove_t Xmove; 690 | lua_yield_t Yield; 691 | luaopen_base_t Open_base; 692 | luaopen_debug_t Open_debug; 693 | //luaopen_io_t Open_io; 694 | luaopen_math_t Open_math; 695 | luaopen_os_t Open_os; 696 | luaopen_package_t Open_package; 697 | luaopen_string_t Open_string; 698 | luaopen_table_t Open_table; 699 | luaopen_bit_t Open_bit; 700 | luaopen_jit_t Open_jit; 701 | //luaopen_ffi_t Open_ffi; 702 | } lua_All_functions; 703 | 704 | extern int luaL_loadfunctions(void* hModule, lua_All_functions* functions, size_t size_struct); 705 | 706 | #ifdef __cplusplus 707 | } 708 | #endif 709 | 710 | #endif 711 | --------------------------------------------------------------------------------