1 // Taken from Derelict-AL 2 module lua.backend.types; 3 4 5 alias lua_CFunction = int function(lua_State*); 6 7 extern (C) nothrow: 8 alias lua_KFunction = int function(lua_State*, int, lua_KContext); 9 alias lua_Reader = const(char)* function(lua_State*, void*, size_t*); 10 alias lua_Writer = int function(lua_State*, const(void)*, size_t, void*); 11 alias lua_Alloc = void* function(void*, void*, size_t, size_t); 12 13 enum LUA_VERSION_MAJOR = "5"; 14 enum LUA_VERSION_MINOR = "3"; 15 enum LUA_VERSION_NUM = 503; 16 enum LUA_VERSION_RELEASE = "5"; 17 18 /* option for multiple returns in 'lua_pcall' and 'lua_call' */ 19 enum LUA_MULTRET = -1; 20 21 /* 22 ** Pseudo-indices 23 ** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty 24 ** space after that to help overflow detection) 25 */ 26 enum LUA_REGISTRYINDEX = -10000; 27 enum LUA_ENVIRONINDEX = -10001; 28 enum LUA_GLOBALSINDEX = -10002; 29 enum LUAI_MAXSTACK = 15000; 30 //enum LUA_REGISTRYINDEX = (-LUAI_MAXSTACK - 1000); 31 32 //enum lua_upvalueindex!(int i) = (LUA_REGISTRYINDEX - (i)); 33 34 enum LUA_OK = 0; 35 enum LUA_YIELD = 1; 36 enum LUA_ERRRUN = 2; 37 enum LUA_ERRSYNTAX = 3; 38 enum LUA_ERRMEM = 4; 39 enum LUA_ERRGCMM = 5; 40 enum LUA_ERRERR = 6; 41 42 struct lua_State; 43 44 /* 45 ** basic types 46 */ 47 enum LUA_TNONE = -1; 48 49 enum LUA_TNIL = 0; 50 enum LUA_TBOOLEAN = 1; 51 enum LUA_TLIGHTUSERDATA = 2; 52 enum LUA_TNUMBER = 3; 53 enum LUA_TSTRING = 4; 54 enum LUA_TTABLE = 5; 55 enum LUA_TFUNCTION = 6; 56 enum LUA_TUSERDATA = 7; 57 enum LUA_TTHREAD = 8; 58 59 enum LUA_NUMTAGS = 9; 60 61 /* minimum Lua stack available to a C function */ 62 enum LUA_MINSTACK = 20; 63 64 /* predefined values in the registry */ 65 enum LUA_RIDX_MAINTHREAD = 1; 66 enum LUA_RIDX_GLOBALS = 2; 67 enum LUA_RIDX_LAST = LUA_RIDX_GLOBALS; 68 69 /* type of numbers in Lua */ 70 alias LUA_NUMBER = double; 71 72 alias LUA_INTEGER = ptrdiff_t; 73 alias LUA_UNSIGNED = uint; 74 alias LUA_KCONTEXT = ptrdiff_t; 75 76 alias lua_Number = LUA_NUMBER; 77 78 alias lua_Integer = LUA_INTEGER; 79 alias lua_Unsigned = LUA_UNSIGNED; 80 alias lua_KContext = LUA_KCONTEXT; 81 82 // luaL 83 enum LUA_NOREF = -2; 84 enum LUA_REFNIL = -1; 85 86 __gshared const(char)[] lua_ident; 87 88 enum LUA_OPADD = 0; /* ORDER TM, ORDER OP */ 89 enum LUA_OPSUB = 1; 90 enum LUA_OPMUL = 2; 91 enum LUA_OPMOD = 3; 92 enum LUA_OPPOW = 4; 93 enum LUA_OPDIV = 5; 94 enum LUA_OPIDIV = 6; 95 enum LUA_OPBAND = 7; 96 enum LUA_OPBOR = 8; 97 enum LUA_OPBXOR = 9; 98 enum LUA_OPSHL = 10; 99 enum LUA_OPSHR = 11; 100 enum LUA_OPUNM = 12; 101 enum LUA_OPBNOT = 13; 102 103 enum LUA_OPEQ = 0; 104 enum LUA_OPLT = 1; 105 enum LUA_OPLE = 2; 106 107 enum LUA_GCSTOP = 0; 108 enum LUA_GCRESTART = 1; 109 enum LUA_GCCOLLECT = 2; 110 enum LUA_GCCOUNT = 3; 111 enum LUA_GCCOUNTB = 4; 112 enum LUA_GCSTEP = 5; 113 enum LUA_GCSETPAUSE = 6; 114 enum LUA_GCSETSTEPMUL = 7; 115 enum LUA_GCISRUNNING = 9; 116 117 /* Key to file-handle type */ 118 enum LUA_FILEHANDLE = "FILE*"; 119 enum LUA_COLIBNAME = "coroutine"; 120 enum LUA_TABLIBNAME = "table"; 121 enum LUA_IOLIBNAME = "io"; 122 enum LUA_OSLIBNAME = "os"; 123 enum LUA_STRLIBNAME = "string"; 124 enum LUA_MATHLIBNAME = "math"; 125 enum LUA_DBLIBNAME = "debug"; 126 enum LUA_LOADLIBNAME = "package"; 127 128 struct luaL_Reg { 129 const(char)* name; 130 lua_CFunction func; 131 }