binddynamic.d 27 KB

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