1 2 // Copyright 2019 - 2021 Michael D. Parker 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 module bindbc.lua.v53.binddynamic; 8 9 version(BindBC_Static) version = BindLua_Static; 10 version(BindLua_Static) {} 11 else version = BindLua_Dynamic; 12 13 version(LUA_53) { 14 version(BindLua_Dynamic) version = LUA_53_DYNAMIC; 15 } 16 17 version(LUA_53_DYNAMIC): 18 19 import core.stdc.stdarg : va_list; 20 import bindbc.loader; 21 import bindbc.lua.config; 22 import bindbc.lua.v53.types; 23 24 extern(C) @nogc nothrow { 25 // lauxlib.h 26 alias pluaL_checkversion_ = void function(lua_State* L, lua_Number ver, size_t sz); 27 alias pluaL_getmetafield = int function(lua_State* L, int obj, const(char)* e); 28 alias pluaL_callmeta = int function(lua_State* L, int obj, const(char)* e); 29 alias pluaL_tolstring = const(char)* function(lua_State* L, int idx, size_t* len); 30 alias pluaL_argerror = int function(lua_State* L, int arg, const(char)* extramsg); 31 alias pluaL_checklstring = const(char)* function(lua_State* L, int arg, size_t* l); 32 alias pluaL_optlstring = const(char)* function(lua_State* L, int arg, const(char)* def, size_t* l); 33 alias pluaL_checknumber = lua_Number function(lua_State* L, int arg); 34 alias pluaL_optnumber = lua_Number function(lua_State* L, int arg, lua_Number def); 35 alias pluaL_checkinteger = lua_Integer function(lua_State* L, int arg); 36 alias pluaL_optinteger = lua_Integer function(lua_State* L, int arg, lua_Integer def); 37 alias pluaL_checkstack = void function(lua_State* L, int sz, const(char)* msg); 38 alias pluaL_checktype = void function(lua_State* L, int arg, int t); 39 alias pluaL_checkany = void function(lua_State* L, int arg); 40 alias pluaL_newmetatable = int function(lua_State* L, const(char)* tname); 41 alias pluaL_setmetatable = void function(lua_State* L, const(char)* tname); 42 alias pluaL_testudata = void* function(lua_State* L, int ud, const(char)* tname); 43 alias pluaL_checkudata = void* function(lua_State* L, int id, const(char)* tname); 44 alias pluaL_where = void function(lua_State* L, int lvl); 45 alias pluaL_error = int function(lua_State* L, const(char)* fmt, ...); 46 alias pluaL_checkoption = int function(lua_State* L, int arg, const(char)* def, const(char)** lst); 47 alias pluaL_fileresult = int function(lua_State* L, int stat, const(char)* fname); 48 alias pluaL_execresult = int function(lua_State* L, int stat); 49 alias pluaL_ref = int function(lua_State* L, int t); 50 alias pluaL_unref = void function(lua_State* L, int t, int ref_); 51 alias pluaL_loadfilex = int function(lua_State* L, const(char)* filename, const(char)* mode); 52 alias pluaL_loadbufferx = int function(lua_State* L, const(char)* buff, size_t sz, const(char)* name, const(char)* mode); 53 alias pluaL_loadstring = int function(lua_State* L, const(char)* s); 54 alias pluaL_newstate = lua_State* function(); 55 alias pluaL_len = int function(lua_State* L, int idx); 56 alias pluaL_gsub = const(char)* function(lua_State* L, const(char)* s, const(char)* p, const(char)* r); 57 alias pluaL_setfuncs = void function(lua_State* L, const(luaL_Reg)* l, int nup); 58 alias pluaL_getsubtable = int function(lua_State* L, int idx, const(char)* fname); 59 alias pluaL_traceback = void function(lua_State* L, lua_State* L1, const(char)* msg, int level); 60 alias pluaL_requiref = void function(lua_State* L, const(char)* modname, lua_CFunction openf, int glb); 61 alias pluaL_buffinit = void function(lua_State* L, luaL_Buffer* B); 62 alias pluaL_prepbuffsize = char* function(luaL_Buffer* B, size_t sz); 63 alias pluaL_addlstring = void function(luaL_Buffer* B, const(char)* s, size_t l); 64 alias pluaL_addstring = void function(luaL_Buffer* B, const(char)* s); 65 alias pluaL_addvalue = void function(luaL_Buffer* B); 66 alias pluaL_pushresult = void function(luaL_Buffer* B); 67 alias pluaL_pushresultsize = void function(luaL_Buffer* B, size_t sz); 68 alias pluaL_buffinitsize = char* function(lua_State* L, luaL_Buffer*, size_t sz); 69 70 // lua.h 71 alias plua_newstate = lua_State* function(lua_Alloc f, void* ud); 72 alias plua_close = void function(lua_State* L); 73 alias plua_newthread = lua_State* function(lua_State* L); 74 alias plua_atpanic = lua_CFunction function(lua_State* L, lua_CFunction panicf); 75 alias plua_version = const(lua_Number)* function(lua_State* L); 76 alias plua_absindex = int function(lua_State* L, int idx); 77 alias plua_gettop = int function(lua_State* L); 78 alias plua_settop = void function(lua_State* L, int idx); 79 alias plua_pushvalue = void function(lua_State* L, int idx); 80 alias plua_rotate = void function(lua_State* L, int idx, int n); 81 alias plua_copy = void function(lua_State* L, int fromidx, int toidx); 82 alias plua_checkstack = int function(lua_State* L, int n); 83 alias plua_xmove = void function(lua_State* L, lua_State* to, int n); 84 alias plua_isnumber = int function(lua_State* L, int idx); 85 alias plua_isstring = int function(lua_State* L, int idx); 86 alias plua_iscfunction = int function(lua_State* L, int idx); 87 alias plua_isinteger = int function(lua_State* L, int idx); 88 alias plua_isuserdata = int function(lua_State* L, int idx); 89 alias plua_type = int function(lua_State* L, int idx); 90 alias plua_typename = const(char)* function(lua_State* L, int tp); 91 alias plua_tonumberx = lua_Number function(lua_State* L, int idx, int* isnum); 92 alias plua_tointegerx = lua_Integer function(lua_State* L, int idx, int* isnum); 93 alias plua_toboolean = int function(lua_State* L, int idx); 94 alias plua_tolstring = const(char)* function(lua_State* L, int idx, size_t* len); 95 alias plua_rawlen = size_t function(lua_State* L, int idx); 96 alias plua_tocfunction = lua_CFunction function(lua_State* L, int idx); 97 alias plua_touserdata = void* function(lua_State* L, int idx); 98 alias plua_tothread = lua_State* function(lua_State* L, int idx); 99 alias plua_topointer = const(void)* function(lua_State* L, int idx); 100 alias plua_arith = void function(lua_State* L, int op); 101 alias plua_rawequal = int function(lua_State* L, int idx1, int idx2); 102 alias plua_compare = int function(lua_State* L, int idx1, int idx2, int op); 103 alias plua_pushnil = void function(lua_State* L); 104 alias plua_pushnumber = void function(lua_State* L, lua_Number n); 105 alias plua_pushinteger = void function(lua_State* L, lua_Integer n); 106 alias plua_pushlstring = const(char)* function(lua_State* L, const(char)* s, size_t len); 107 alias plua_pushstring = const(char)* function(lua_State* L, const(char)* s); 108 alias plua_pushvfstring = const(char)* function(lua_State* L, const(char)* fmt, va_list argp); 109 alias plua_pushfstring = const(char)* function(lua_State* L, const(char)* fmt, ...); 110 alias plua_pushcclosure = void function(lua_State* L, lua_CFunction fn, int n); 111 alias plua_pushboolean = void function(lua_State* L, int b); 112 alias plua_pushlightuserdata = void function(lua_State* L, void* p); 113 alias plua_pushthread = int function(lua_State* L); 114 alias plua_getglobal = int function(lua_State* L, const(char)* name); 115 alias plua_gettable = int function(lua_State* L, int idx); 116 alias plua_getfield = int function(lua_State* L, int idx, const(char)* k); 117 alias plua_geti = int function(lua_State* L, int idx, lua_Integer n); 118 alias plua_rawget = int function(lua_State* L, int idx); 119 alias plua_rawgeti = int function(lua_State* L, int idx, int b); 120 alias plua_rawgetp = int function(lua_State* L, int idx, const(void)* p); 121 alias plua_createtable = void function(lua_State* L, int narr, int nrecs); 122 alias plua_newuserdata = void* function(lua_State* L, size_t sz); 123 alias plua_getmetatable = int function(lua_State* L, int objindex); 124 alias plua_getuservalue = int function(lua_State* L, int idx); 125 alias plua_setglobal = void function(lua_State* L, const(char)* name); 126 alias plua_settable = void function(lua_State* L, int idx); 127 alias plua_setfield = void function(lua_State* L, int idx, const(char)* k); 128 alias plua_seti = void function(lua_State* L, int idx, lua_Integer n); 129 alias plua_rawset = void function(lua_State* L, int idx); 130 alias plua_rawseti = void function(lua_State* L, int idx, lua_Integer n); 131 alias plua_rawsetp = void function(lua_State* L, int idx, const(void)* p); 132 alias plua_setmetatable = int function(lua_State* L, int objindex); 133 alias plua_setuservalue = int function(lua_State* L, int idx); 134 alias plua_callk = void function(lua_State* L, int nargs, int nresults, lua_KContext ctx, lua_KFunction k); 135 alias plua_pcallk = int function(lua_State* L, int nargs, int nresults, int errfunc, lua_KContext ctx, lua_KFunction k); 136 alias plua_load = int function(lua_State* L, lua_Reader reader, void* dt, const(char)* chunkname, const(char)* mode); 137 alias plua_dump = int function(lua_State* L, lua_Writer writer, void* data, int strip); 138 alias plua_yieldk = int function(lua_State* L, int nresults, lua_KContext ctx, lua_KFunction k); 139 alias plua_resume = int function(lua_State* L, lua_State* from, int narg); 140 alias plua_status = int function(lua_State* L); 141 alias plua_isyieldable = int function(lua_State* L); 142 alias plua_gc = int function(lua_State* L, int what, int data); 143 alias plua_error = int function(lua_State* L); 144 alias plua_next = int function(lua_State* L, int idx); 145 alias plua_concat = void function(lua_State* L, int n); 146 alias plua_len = void function(lua_State* L, int idx); 147 alias plua_stringtonumber = size_t function(lua_State* L, const(char)* s); 148 alias plua_getallocf = lua_Alloc function(lua_State* L, void** ud); 149 alias plua_setallocf = void function(lua_State* L, lua_Alloc f, void* ud); 150 alias plua_getstack = int function(lua_State* L, int, lua_Debug* ar); 151 alias plua_getinfo = int function(lua_State* L, const(char)* what, lua_Debug* ar); 152 alias plua_getlocal = const(char)* function(lua_State* L, const(lua_Debug)* ar, int n); 153 alias plua_setlocal = const(char)* function(lua_State* L, const(lua_Debug)* ar, int n); 154 alias plua_getupvalue = const(char)* function(lua_State* L, int funcindex, int n); 155 alias plua_setupvalue = const(char)* function(lua_State* L, int funcindex, int n); 156 alias plua_upvalueid = void* function(lua_State* L, int fidx, int n); 157 alias plua_upvaluejoin = void function(lua_State* L, int fidx1, int n1, int fidx2, int n2); 158 alias plua_sethook = int function(lua_State* L, lua_Hook func, int mask, int count); 159 alias plua_gethook = lua_Hook function(lua_State* L); 160 alias plua_gethookmask = int function(lua_State* L); 161 alias plua_gethookcount = int function(lua_State* L); 162 163 // lualib.h 164 alias pluaopen_base = int function(lua_State* L); 165 alias pluaopen_coroutine = int function(lua_State* L); 166 alias pluaopen_table = int function(lua_State* L); 167 alias pluaopen_io = int function(lua_State* L); 168 alias pluaopen_os = int function(lua_State* L); 169 alias pluaopen_string = int function(lua_State* L); 170 alias pluaopen_utf8 = int function(lua_State* L); 171 alias pluaopen_bit32 = int function(lua_State* L); 172 alias pluaopen_math = int function(lua_State* L); 173 alias pluaopen_debug = int function(lua_State* L); 174 alias pluaopen_package = int function(lua_State* L); 175 alias pluaL_openlibs = void function(lua_State* L); 176 } 177 178 __gshared { 179 // lauxlib.h 180 pluaL_checkversion_ luaL_checkversion_; 181 pluaL_getmetafield luaL_getmetafield; 182 pluaL_callmeta luaL_callmeta; 183 pluaL_tolstring luaL_tolstring; 184 pluaL_argerror luaL_argerror; 185 pluaL_checklstring luaL_checklstring; 186 pluaL_optlstring luaL_optlstring; 187 pluaL_checknumber luaL_checknumber; 188 pluaL_optnumber luaL_optnumber; 189 pluaL_checkinteger luaL_checkinteger; 190 pluaL_optinteger luaL_optinteger; 191 pluaL_checkstack luaL_checkstack; 192 pluaL_checktype luaL_checktype; 193 pluaL_checkany luaL_checkany; 194 pluaL_newmetatable luaL_newmetatable; 195 pluaL_setmetatable luaL_setmetatable; 196 pluaL_testudata luaL_testudata; 197 pluaL_checkudata luaL_checkudata; 198 pluaL_where luaL_where; 199 pluaL_error luaL_error; 200 pluaL_checkoption luaL_checkoption; 201 pluaL_fileresult luaL_fileresult; 202 pluaL_execresult luaL_execresult; 203 pluaL_ref luaL_ref; 204 pluaL_unref luaL_unref; 205 pluaL_loadfilex luaL_loadfilex; 206 pluaL_loadbufferx luaL_loadbufferx; 207 pluaL_loadstring luaL_loadstring; 208 pluaL_newstate luaL_newstate; 209 pluaL_len luaL_len; 210 pluaL_gsub luaL_gsub; 211 pluaL_setfuncs luaL_setfuncs; 212 pluaL_getsubtable luaL_getsubtable; 213 pluaL_traceback luaL_traceback; 214 pluaL_requiref luaL_requiref; 215 pluaL_buffinit luaL_buffinit; 216 pluaL_prepbuffsize luaL_prepbuffsize; 217 pluaL_addlstring luaL_addlstring; 218 pluaL_addstring luaL_addstring; 219 pluaL_addvalue luaL_addvalue; 220 pluaL_pushresult luaL_pushresult; 221 pluaL_pushresultsize luaL_pushresultsize; 222 pluaL_buffinitsize luaL_buffinitsize; 223 224 // lua.h 225 plua_newstate lua_newstate; 226 plua_close lua_close; 227 plua_newthread lua_newthread; 228 plua_atpanic lua_atpanic; 229 plua_version lua_version; 230 plua_absindex lua_absindex; 231 plua_gettop lua_gettop; 232 plua_settop lua_settop; 233 plua_pushvalue lua_pushvalue; 234 plua_rotate lua_rotate; 235 plua_copy lua_copy; 236 plua_checkstack lua_checkstack; 237 plua_xmove lua_xmove; 238 plua_isnumber lua_isnumber; 239 plua_isstring lua_isstring; 240 plua_iscfunction lua_iscfunction; 241 plua_isinteger lua_isinteger; 242 plua_isuserdata lua_isuserdata; 243 plua_type lua_type; 244 plua_typename lua_typename; 245 plua_tonumberx lua_tonumberx; 246 plua_tointegerx lua_tointegerx; 247 plua_toboolean lua_toboolean; 248 plua_tolstring lua_tolstring; 249 plua_rawlen lua_rawlen; 250 plua_tocfunction lua_tocfunction; 251 plua_touserdata lua_touserdata; 252 plua_tothread lua_tothread; 253 plua_topointer lua_topointer; 254 plua_arith lua_arith; 255 plua_rawequal lua_rawequal; 256 plua_compare lua_compare; 257 plua_pushnil lua_pushnil; 258 plua_pushnumber lua_pushnumber; 259 plua_pushinteger lua_pushinteger; 260 plua_pushlstring lua_pushlstring; 261 plua_pushstring lua_pushstring; 262 plua_pushvfstring lua_pushvfstring; 263 plua_pushfstring lua_pushfstring; 264 plua_pushcclosure lua_pushcclosure; 265 plua_pushboolean lua_pushboolean; 266 plua_pushlightuserdata lua_pushlightuserdata; 267 plua_pushthread lua_pushthread; 268 plua_getglobal lua_getglobal; 269 plua_gettable lua_gettable; 270 plua_getfield lua_getfield; 271 plua_geti lua_geti; 272 plua_rawget lua_rawget; 273 plua_rawgeti lua_rawgeti; 274 plua_rawgetp lua_rawgetp; 275 plua_createtable lua_createtable; 276 plua_newuserdata lua_newuserdata; 277 plua_getmetatable lua_getmetatable; 278 plua_getuservalue lua_getuservalue; 279 plua_setglobal lua_setglobal; 280 plua_settable lua_settable; 281 plua_setfield lua_setfield; 282 plua_seti lua_seti; 283 plua_rawset lua_rawset; 284 plua_rawseti lua_rawseti; 285 plua_rawsetp lua_rawsetp; 286 plua_setmetatable lua_setmetatable; 287 plua_setuservalue lua_setuservalue; 288 plua_callk lua_callk; 289 plua_pcallk lua_pcallk; 290 plua_load lua_load; 291 plua_dump lua_dump; 292 plua_yieldk lua_yieldk; 293 plua_resume lua_resume; 294 plua_status lua_status; 295 plua_isyieldable lua_isyieldable; 296 plua_gc lua_gc; 297 plua_error lua_error; 298 plua_next lua_next; 299 plua_concat lua_concat; 300 plua_len lua_len; 301 plua_stringtonumber lua_stringtonumber; 302 plua_getallocf lua_getallocf; 303 plua_setallocf lua_setallocf; 304 plua_getstack lua_getstack; 305 plua_getinfo lua_getinfo; 306 plua_getlocal lua_getlocal; 307 plua_setlocal lua_setlocal; 308 plua_getupvalue lua_getupvalue; 309 plua_setupvalue lua_setupvalue; 310 plua_upvalueid lua_upvalueid; 311 plua_upvaluejoin lua_upvaluejoin; 312 plua_sethook lua_sethook; 313 plua_gethook lua_gethook; 314 plua_gethookmask lua_gethookmask; 315 plua_gethookcount lua_gethookcount; 316 317 // lualib.h 318 pluaopen_base luaopen_base; 319 pluaopen_coroutine luaopen_coroutine; 320 pluaopen_table luaopen_table; 321 pluaopen_io luaopen_io; 322 pluaopen_os luaopen_os; 323 pluaopen_string luaopen_string; 324 pluaopen_utf8 luaopen_utf8; 325 pluaopen_bit32 luaopen_bit32; 326 pluaopen_math luaopen_math; 327 pluaopen_debug luaopen_debug; 328 pluaopen_package luaopen_package; 329 pluaL_openlibs luaL_openlibs; 330 } 331 332 private { 333 SharedLib lib; 334 LuaSupport loadedVersion; 335 } 336 337 @nogc nothrow: 338 339 void unloadLua() 340 { 341 if(lib != invalidHandle) { 342 lib.unload; 343 } 344 } 345 346 LuaSupport loadedLuaVersion() @safe { return loadedVersion; } 347 bool isLuaLoaded() @safe { return lib != invalidHandle; } 348 349 LuaSupport loadLua() 350 { 351 version(Windows) { 352 const(char)[][3] libNames = ["lua5.3.dll", "lua53.dll", "lua5.3.5.dll"]; 353 } 354 else version(OSX) { 355 const(char)[][1] libNames = "liblua.5.3.dylib"; 356 } 357 else version(Posix) { 358 const(char)[][3] libNames = ["liblua.so.5.3", "liblua5.3.so", "liblua-5.3.so"]; 359 } 360 else static assert(0, "bindbc-lua support for Lua 5.3 is not implemented on this platform."); 361 362 LuaSupport ret; 363 foreach(name; libNames) { 364 ret = loadLua(name.ptr); 365 if(ret != LuaSupport.noLibrary) break; 366 } 367 return ret; 368 } 369 370 LuaSupport loadLua(const(char)* libName) 371 { 372 lib = load(libName); 373 if(lib == invalidHandle) { 374 return LuaSupport.noLibrary; 375 } 376 377 auto errCount = errorCount(); 378 loadedVersion = LuaSupport.badLibrary; 379 380 // lauxlib.h 381 lib.bindSymbol(cast(void**)&luaL_checkversion_, "luaL_checkversion_"); 382 lib.bindSymbol(cast(void**)&luaL_getmetafield,"luaL_getmetafield"); 383 lib.bindSymbol(cast(void**)&luaL_callmeta, "luaL_callmeta"); 384 lib.bindSymbol(cast(void**)&luaL_tolstring, "luaL_tolstring"); 385 lib.bindSymbol(cast(void**)&luaL_argerror, "luaL_argerror"); 386 lib.bindSymbol(cast(void**)&luaL_checklstring, "luaL_checklstring"); 387 lib.bindSymbol(cast(void**)&luaL_optlstring, "luaL_optlstring"); 388 lib.bindSymbol(cast(void**)&luaL_checknumber, "luaL_checknumber"); 389 lib.bindSymbol(cast(void**)&luaL_optnumber, "luaL_optnumber"); 390 lib.bindSymbol(cast(void**)&luaL_checkinteger, "luaL_checkinteger"); 391 lib.bindSymbol(cast(void**)&luaL_optinteger, "luaL_optinteger"); 392 lib.bindSymbol(cast(void**)&luaL_checkstack, "luaL_checkstack"); 393 lib.bindSymbol(cast(void**)&luaL_checktype, "luaL_checktype"); 394 lib.bindSymbol(cast(void**)&luaL_checkany, "luaL_checkany"); 395 lib.bindSymbol(cast(void**)&luaL_newmetatable, "luaL_newmetatable"); 396 lib.bindSymbol(cast(void**)&luaL_setmetatable, "luaL_setmetatable"); 397 lib.bindSymbol(cast(void**)&luaL_testudata, "luaL_testudata"); 398 lib.bindSymbol(cast(void**)&luaL_checkudata, "luaL_checkudata"); 399 lib.bindSymbol(cast(void**)&luaL_where, "luaL_where"); 400 lib.bindSymbol(cast(void**)&luaL_error, "luaL_error"); 401 lib.bindSymbol(cast(void**)&luaL_checkoption, "luaL_checkoption"); 402 lib.bindSymbol(cast(void**)&luaL_fileresult, "luaL_fileresult"); 403 lib.bindSymbol(cast(void**)&luaL_execresult, "luaL_execresult"); 404 lib.bindSymbol(cast(void**)&luaL_ref, "luaL_ref"); 405 lib.bindSymbol(cast(void**)&luaL_unref, "luaL_unref"); 406 lib.bindSymbol(cast(void**)&luaL_loadfilex, "luaL_loadfilex"); 407 lib.bindSymbol(cast(void**)&luaL_loadbufferx, "luaL_loadbufferx"); 408 lib.bindSymbol(cast(void**)&luaL_loadstring, "luaL_loadstring"); 409 lib.bindSymbol(cast(void**)&luaL_newstate, "luaL_newstate"); 410 lib.bindSymbol(cast(void**)&luaL_len, "luaL_len"); 411 lib.bindSymbol(cast(void**)&luaL_gsub, "luaL_gsub"); 412 lib.bindSymbol(cast(void**)&luaL_setfuncs, "luaL_setfuncs"); 413 lib.bindSymbol(cast(void**)&luaL_getsubtable, "luaL_getsubtable"); 414 lib.bindSymbol(cast(void**)&luaL_traceback, "luaL_traceback"); 415 lib.bindSymbol(cast(void**)&luaL_requiref, "luaL_requiref"); 416 lib.bindSymbol(cast(void**)&luaL_buffinit, "luaL_buffinit"); 417 lib.bindSymbol(cast(void**)&luaL_prepbuffsize, "luaL_prepbuffsize"); 418 lib.bindSymbol(cast(void**)&luaL_addlstring, "luaL_addlstring"); 419 lib.bindSymbol(cast(void**)&luaL_addstring, "luaL_addstring"); 420 lib.bindSymbol(cast(void**)&luaL_addvalue, "luaL_addvalue"); 421 lib.bindSymbol(cast(void**)&luaL_pushresult, "luaL_pushresult"); 422 lib.bindSymbol(cast(void**)&luaL_pushresultsize, "luaL_pushresultsize"); 423 lib.bindSymbol(cast(void**)&luaL_buffinitsize, "luaL_buffinitsize"); 424 425 // lua.h 426 lib.bindSymbol(cast(void**)&lua_newstate, "lua_newstate"); 427 lib.bindSymbol(cast(void**)&lua_close, "lua_close"); 428 lib.bindSymbol(cast(void**)&lua_newthread, "lua_newthread"); 429 lib.bindSymbol(cast(void**)&lua_atpanic, "lua_atpanic"); 430 lib.bindSymbol(cast(void**)&lua_version, "lua_version"); 431 lib.bindSymbol(cast(void**)&lua_absindex, "lua_absindex"); 432 lib.bindSymbol(cast(void**)&lua_gettop, "lua_gettop"); 433 lib.bindSymbol(cast(void**)&lua_settop, "lua_settop"); 434 lib.bindSymbol(cast(void**)&lua_pushvalue, "lua_pushvalue"); 435 lib.bindSymbol(cast(void**)&lua_rotate, "lua_rotate"); 436 lib.bindSymbol(cast(void**)&lua_copy, "lua_copy"); 437 lib.bindSymbol(cast(void**)&lua_checkstack, "lua_checkstack"); 438 lib.bindSymbol(cast(void**)&lua_xmove, "lua_xmove"); 439 lib.bindSymbol(cast(void**)&lua_isnumber, "lua_isnumber"); 440 lib.bindSymbol(cast(void**)&lua_isstring, "lua_isstring"); 441 lib.bindSymbol(cast(void**)&lua_iscfunction, "lua_iscfunction"); 442 lib.bindSymbol(cast(void**)&lua_isinteger, "lua_isinteger"); 443 lib.bindSymbol(cast(void**)&lua_isuserdata, "lua_isuserdata"); 444 lib.bindSymbol(cast(void**)&lua_type, "lua_type"); 445 lib.bindSymbol(cast(void**)&lua_typename, "lua_typename"); 446 lib.bindSymbol(cast(void**)&lua_tonumberx, "lua_tonumberx"); 447 lib.bindSymbol(cast(void**)&lua_tointegerx, "lua_tointegerx"); 448 lib.bindSymbol(cast(void**)&lua_toboolean, "lua_toboolean"); 449 lib.bindSymbol(cast(void**)&lua_tolstring, "lua_tolstring"); 450 lib.bindSymbol(cast(void**)&lua_rawlen, "lua_rawlen"); 451 lib.bindSymbol(cast(void**)&lua_tocfunction, "lua_tocfunction"); 452 lib.bindSymbol(cast(void**)&lua_touserdata, "lua_touserdata"); 453 lib.bindSymbol(cast(void**)&lua_tothread, "lua_tothread"); 454 lib.bindSymbol(cast(void**)&lua_topointer, "lua_topointer"); 455 lib.bindSymbol(cast(void**)&lua_arith, "lua_arith"); 456 lib.bindSymbol(cast(void**)&lua_rawequal, "lua_rawequal"); 457 lib.bindSymbol(cast(void**)&lua_compare, "lua_compare"); 458 lib.bindSymbol(cast(void**)&lua_pushnil, "lua_pushnil"); 459 lib.bindSymbol(cast(void**)&lua_pushnumber, "lua_pushnumber"); 460 lib.bindSymbol(cast(void**)&lua_pushinteger, "lua_pushinteger"); 461 lib.bindSymbol(cast(void**)&lua_pushlstring, "lua_pushlstring"); 462 lib.bindSymbol(cast(void**)&lua_pushstring, "lua_pushstring"); 463 lib.bindSymbol(cast(void**)&lua_pushvfstring, "lua_pushvfstring"); 464 lib.bindSymbol(cast(void**)&lua_pushfstring, "lua_pushfstring"); 465 lib.bindSymbol(cast(void**)&lua_pushcclosure, "lua_pushcclosure"); 466 lib.bindSymbol(cast(void**)&lua_pushboolean, "lua_pushboolean"); 467 lib.bindSymbol(cast(void**)&lua_pushlightuserdata, "lua_pushlightuserdata"); 468 lib.bindSymbol(cast(void**)&lua_pushthread, "lua_pushthread"); 469 lib.bindSymbol(cast(void**)&lua_getglobal, "lua_getglobal"); 470 lib.bindSymbol(cast(void**)&lua_gettable, "lua_gettable"); 471 lib.bindSymbol(cast(void**)&lua_getfield, "lua_getfield"); 472 lib.bindSymbol(cast(void**)&lua_geti, "lua_geti"); 473 lib.bindSymbol(cast(void**)&lua_rawget, "lua_rawget"); 474 lib.bindSymbol(cast(void**)&lua_rawgeti, "lua_rawgeti"); 475 lib.bindSymbol(cast(void**)&lua_rawgetp, "lua_rawgetp"); 476 lib.bindSymbol(cast(void**)&lua_createtable, "lua_createtable"); 477 lib.bindSymbol(cast(void**)&lua_newuserdata, "lua_newuserdata"); 478 lib.bindSymbol(cast(void**)&lua_getmetatable, "lua_getmetatable"); 479 lib.bindSymbol(cast(void**)&lua_getuservalue, "lua_getuservalue"); 480 lib.bindSymbol(cast(void**)&lua_setglobal, "lua_setglobal"); 481 lib.bindSymbol(cast(void**)&lua_settable, "lua_settable"); 482 lib.bindSymbol(cast(void**)&lua_setfield, "lua_setfield"); 483 lib.bindSymbol(cast(void**)&lua_seti, "lua_seti"); 484 lib.bindSymbol(cast(void**)&lua_rawset, "lua_rawset"); 485 lib.bindSymbol(cast(void**)&lua_rawseti, "lua_rawseti"); 486 lib.bindSymbol(cast(void**)&lua_rawsetp, "lua_rawsetp"); 487 lib.bindSymbol(cast(void**)&lua_setmetatable, "lua_setmetatable"); 488 lib.bindSymbol(cast(void**)&lua_setuservalue, "lua_setuservalue"); 489 lib.bindSymbol(cast(void**)&lua_callk, "lua_callk"); 490 lib.bindSymbol(cast(void**)&lua_pcallk, "lua_pcallk"); 491 lib.bindSymbol(cast(void**)&lua_load, "lua_load"); 492 lib.bindSymbol(cast(void**)&lua_dump, "lua_dump"); 493 lib.bindSymbol(cast(void**)&lua_yieldk, "lua_yieldk"); 494 lib.bindSymbol(cast(void**)&lua_resume, "lua_resume"); 495 lib.bindSymbol(cast(void**)&lua_status, "lua_status"); 496 lib.bindSymbol(cast(void**)&lua_isyieldable, "lua_isyieldable"); 497 lib.bindSymbol(cast(void**)&lua_gc, "lua_gc"); 498 lib.bindSymbol(cast(void**)&lua_error, "lua_error"); 499 lib.bindSymbol(cast(void**)&lua_next, "lua_next"); 500 lib.bindSymbol(cast(void**)&lua_concat, "lua_concat"); 501 lib.bindSymbol(cast(void**)&lua_len, "lua_len"); 502 lib.bindSymbol(cast(void**)&lua_stringtonumber, "lua_stringtonumber"); 503 lib.bindSymbol(cast(void**)&lua_getallocf, "lua_getallocf"); 504 lib.bindSymbol(cast(void**)&lua_setallocf, "lua_setallocf"); 505 lib.bindSymbol(cast(void**)&lua_getstack, "lua_getstack"); 506 lib.bindSymbol(cast(void**)&lua_getinfo, "lua_getinfo"); 507 lib.bindSymbol(cast(void**)&lua_getlocal, "lua_getlocal"); 508 lib.bindSymbol(cast(void**)&lua_setlocal, "lua_setlocal"); 509 lib.bindSymbol(cast(void**)&lua_getupvalue, "lua_getupvalue"); 510 lib.bindSymbol(cast(void**)&lua_setupvalue, "lua_setupvalue"); 511 lib.bindSymbol(cast(void**)&lua_upvalueid, "lua_upvalueid"); 512 lib.bindSymbol(cast(void**)&lua_upvaluejoin, "lua_upvaluejoin"); 513 lib.bindSymbol(cast(void**)&lua_sethook, "lua_sethook"); 514 lib.bindSymbol(cast(void**)&lua_gethook, "lua_gethook"); 515 lib.bindSymbol(cast(void**)&lua_gethookmask, "lua_gethookmask"); 516 lib.bindSymbol(cast(void**)&lua_gethookcount, "lua_gethookcount"); 517 518 // lualib.h 519 lib.bindSymbol(cast(void**)&luaopen_base, "luaopen_base"); 520 lib.bindSymbol(cast(void**)&luaopen_coroutine, "luaopen_coroutine"); 521 lib.bindSymbol(cast(void**)&luaopen_table, "luaopen_table"); 522 lib.bindSymbol(cast(void**)&luaopen_io, "luaopen_io"); 523 lib.bindSymbol(cast(void**)&luaopen_os, "luaopen_os"); 524 lib.bindSymbol(cast(void**)&luaopen_string, "luaopen_string"); 525 lib.bindSymbol(cast(void**)&luaopen_utf8, "luaopen_utf8"); 526 lib.bindSymbol(cast(void**)&luaopen_bit32, "luaopen_bit32"); 527 lib.bindSymbol(cast(void**)&luaopen_math, "luaopen_math"); 528 lib.bindSymbol(cast(void**)&luaopen_debug, "luaopen_debug"); 529 lib.bindSymbol(cast(void**)&luaopen_package, "luaopen_package"); 530 lib.bindSymbol(cast(void**)&luaL_openlibs, "luaL_openlibs"); 531 532 return LuaSupport.lua53; 533 }