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