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