1 /*
2                                     __
3                                    / _|
4   __ _ _   _ _ __ ___  _ __ __ _  | |_ ___  ___ ___
5  / _` | | | | '__/ _ \| '__/ _` | |  _/ _ \/ __/ __|
6 | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \
7  \__,_|\__,_|_|  \___/|_|  \__,_| |_| \___/|___/___/
8 
9 Copyright (C) 1994-2020 Lua.org, PUC-Rio.
10 Copyright (C) 2018-2020 Aurora Free Open Source Software.
11 Copyright (C) 2018-2020 Luís Ferreira <luis@aurorafoss.org>
12 
13 This file is part of the Aurora Free Open Source Software. This
14 organization promote free and open source software that you can
15 redistribute and/or modify under the terms of the GNU Lesser General
16 Public License Version 3 as published by the Free Software Foundation or
17 (at your option) any later version approved by the Aurora Free Open Source
18 Software Organization. The license is available in the package root path
19 as 'LICENSE' file. Please review the following information to ensure the
20 GNU Lesser General Public License version 3 requirements will be met:
21 https://www.gnu.org/licenses/lgpl.html .
22 
23 Alternatively, this file may be used under the terms of the GNU General
24 Public License version 3 or later as published by the Free Software
25 Foundation. Please review the following information to ensure the GNU
26 General Public License requirements will be met:
27 http://www.gnu.org/licenses/gpl-3.0.html.
28 
29 NOTE: All products, services or anything associated to trademarks and
30 service marks used or referenced on this file are the property of their
31 respective companies/owners or its subsidiaries. Other names and brands
32 may be claimed as the property of others.
33 
34 For more info about intellectual property visit: aurorafoss.org or
35 directly send an email to: contact (at) aurorafoss.org .
36 */
37 
38 /++
39 Type definitions for Lua bindings
40 
41 This file defines all types for Lua library bindings.
42 
43 Authors: Luís Ferreira <luis@aurorafoss.org>
44 Copyright: All rights reserved, Aurora Free Open Source Software
45 License: GNU Lesser General Public License (Version 3, 29 June 2007)
46 Date: 2018-2019
47 +/
48 module riverd.lua.types;
49 
50 import core.stdc.stdarg;
51 
52 
53 /** Lua 32-bit integer type */
54 alias LUA_INT32 = int;
55 
56 
57 /** Unsigned type of the integral basic types
58  *
59  * Represents a type that is large enough to represent an offset into all
60  * addressable memory
61  *
62  * See_Also: $(LREF LUAI_MEM)
63  */
64 alias LUAI_UMEM = size_t;
65 
66 
67 /** Signed integral basic type with the same size as LUAI_UMEM
68  *
69  * See_Also: $(LREF LUAI_UMEM)
70   */
71 alias LUAI_MEM = ptrdiff_t;
72 
73 
74 /** 64-bit floating point type */
75 alias LUAI_UACNUMBER = double;
76 
77 
78 enum {
79 	LUA_NUMBER_SCAN = "%lf", /** scan formatter for lua numbers */
80 	LUA_NUMBER_FMT = "%.14g", /** formatter for lua numbers */
81 }
82 
83 
84 /** Limits the size of the Lua stack.
85  *
86  * Its only purpose is to stop Lua from consuming unlimited stack
87  * space (and to reserve some numbers for pseudo-indices).
88 */
89 enum LUAI_MAXSTACK = 1_000_000;
90 
91 
92 /** Defines the size of a raw memory area.
93  *
94  * Associated with a Lua state with very fast access.
95  */
96 enum LUA_EXTRASPACE = (void*).sizeof;
97 
98 
99 /** Mininum Major Lua version in which these bindings are compatible
100  *
101  * See_Also: $(LREF LUA_VERSION_MINOR)
102  */
103 enum LUA_VERSION_MAJOR ="5";
104 
105 
106 /** Minimum Minor Lua version in which these bindings are compatible
107  *
108  * See_Also: $(LREF LUA_VERSION_MAJOR)
109  */
110 enum LUA_VERSION_MINOR ="4";
111 
112 
113 /** Minimum Lua version number in which these bindings are compatible
114  *
115  * See_Also: $(LREF LUA_VERSION)
116  */
117 enum LUA_VERSION_NUM = 504;
118 
119 
120 /** Minimum Lua release version in which these bindings are compatible
121  *
122  * See_Also: $(LREF LUA_RELEASE)
123  */
124 enum LUA_VERSION_RELEASE = "0";
125 
126 /** Lua Release version number in which these bindings are compatible
127  *
128  * See_Also: $(LREF LUA_RELEASE)
129  */
130 enum LUA_VERSION_RELEASE_NUM = (LUA_VERSION_NUM * 100 + 0);
131 
132 
133 /** Minimum Lua version in which these bindings are compatible
134  *
135  * See_Also: $(LREF LUA_VERSION_NUM)
136  */
137 enum LUA_VERSION = "Lua " ~ LUA_VERSION_MAJOR ~ "." ~ LUA_VERSION_MINOR;
138 
139 
140 /** Minimum Lua release in which these bindings are compatible
141  *
142  * See_Also: $(LREF LUA_VERSION_RELEASE)
143  */
144 enum LUA_RELEASE = LUA_VERSION ~ "." ~ LUA_VERSION_RELEASE;
145 
146 
147 /** Lua copyright statement
148  *
149  * See_Also: $(LREF LUA_AUTHORS)
150  */
151 enum LUA_COPYRIGHT = LUA_RELEASE ~ "  Copyright (C) 1994-2020 Lua.org, PUC-Rio";
152 
153 
154 /** Lua authors
155  *
156  * See_Also: $(LREF LUA_COPYRIGHT)
157  */
158 enum LUA_AUTHORS = "R. Ierusalimschy, L. H. de Figueiredo, W. Celes";
159 
160 
161 /** mark for precompiled code ('<esc>Lua') */
162 enum LUA_SIGNATURE = "\x1bLua";
163 
164 
165 /** option for multiple returns in 'lua_pcall' and 'lua_call' */
166 enum LUA_MULTRET = -1;
167 
168 
169 /** The minimum valid index */
170 enum LUA_REGISTRYINDEX = -LUAI_MAXSTACK - 1_000;
171 
172 
173 /** Pseudo-indices
174  *
175  * See_Also: $(LREF LUA_REGISTRYINDEX)
176  */
177 int lua_upvalueindex(int i) nothrow {
178 	return LUA_REGISTRYINDEX - i;
179 }
180 
181 
182 /** Thread status */
183 enum {
184 	LUA_OK			= 0, /** no errors */
185 	LUA_YIELD		= 1, /** yield thread status */
186 	LUA_ERRRUN		= 2, /** runtime error */
187 	LUA_ERRSYNTAX	= 3, /** syntax error during precompilation */
188 	LUA_ERRMEM		= 4, /** memory allocation (out-of-memory) error */
189 	LUA_ERRERR		= 5, /** error while running the message handler. */
190 }
191 
192 
193 /** Lua thread state.
194  *
195  * Indirectly, through the thread, it also refers to the Lua
196  * state associated to the thread.
197  */
198 struct lua_State;
199 
200 
201 /** Lua types */
202 enum
203 {
204 	LUA_TNONE			= -1, /** non-valid (but acceptable) index. */
205 	LUA_TNIL			= 0, /** Lua NIL type */
206 	LUA_TBOOLEAN		= 1, /** boolean type */
207 	LUA_TLIGHTUSERDATA	= 2, /** light user data type */
208 	LUA_TNUMBER			= 3, /** number type */
209 	LUA_TSTRING			= 4, /** string type */
210 	LUA_TTABLE			= 5, /** table type */
211 	LUA_TFUNCTION		= 6, /** function type */
212 	LUA_TUSERDATA		= 7, /** user data type */
213 	LUA_TTHREAD			= 8, /** thread type */
214 	LUA_NUMTYPES		= 9, /** number types */
215 }
216 
217 /** Lua type number tags */
218 enum LUA_NUMTAGS = LUA_NUMTYPES;
219 
220 
221 /** minimum Lua stack available to a C function */
222 enum LUA_MINSTACK = 20;
223 
224 
225 /** predefined values in the registry */
226 enum
227 {
228 	LUA_RIDX_MAINTHREAD	= 1, /** the main thread registry index of the state */
229 	LUA_RIDX_GLOBALS	= 2, /** the global environment registry index */
230 	LUA_RIDX_LAST		= LUA_RIDX_GLOBALS, /** the last registery index */
231 }
232 
233 
234 alias lua_Number = double; /** type of numbers in Lua */
235 alias lua_Integer = long; /** type for integer functions */
236 alias lua_Unsigned = uint; /** type for integer functions */
237 alias lua_KContext = ptrdiff_t; /** type for continuation-function contexts */
238 
239 
240 /** alias to lua_Number
241  *
242  * See_Also: $(LREF lua_Number)
243  */
244 alias LUA_NUMBER = lua_Number;
245 
246 
247 /** alias to lua_Integer
248  *
249  * See_Also: $(LREF lua_Integer)
250  */
251 alias LUA_INTEGER = lua_Integer;
252 
253 
254 /** alias to lua_Unsigned
255  *
256  * See_Also: $(LREF lua_Unsigned)
257  */
258 alias LUA_UNSIGNED = lua_Unsigned;
259 
260 
261 /** alias to lua_KContext
262  *
263  * See_Also: $(LREF lua_KContext)
264  */
265 alias LUA_KCONTEXT = lua_KContext;
266 
267 
268 extern(C) nothrow {
269 
270 	/** Type for C functions registered with Lua */
271 	alias lua_CFunction = int function(lua_State*);
272 
273 
274 	/** Type for continuation functions */
275 	alias lua_KFunction = int function(lua_State*, int, lua_KContext);
276 
277 
278 	/** Type for functions that read/write blocks when loading/dumping Lua chunks */
279 	alias lua_Reader = const(char)* function(lua_State*, void*, size_t*);
280 
281 	/// ditto
282 	alias lua_Writer = int function(lua_State*, const(void)*, size_t, void*);
283 
284 
285 	/** Type for memory-allocation functions */
286 	alias lua_Alloc = void* function(void*, void*, size_t, size_t);
287 
288 	/** Type for warning functions */
289 	alias lua_WarnFunction = void* function(void*, const char*, int);
290 }
291 
292 
293 /** Comparison annd arithmetic functions */
294 enum {
295 	LUA_OPADD = 0,
296 	LUA_OPSUB = 1,
297 	LUA_OPMUL = 2,
298 	LUA_OPMOD = 3,
299 	LUA_OPPOW = 4,
300 	LUA_OPDIV = 5,
301 	LUA_OPIDIV = 6,
302 	LUA_OPBAND = 7,
303 	LUA_OPBOR = 8,
304 	LUA_OPBXOR = 9,
305 	LUA_OPSHL = 10,
306 	LUA_OPSHR = 11,
307 	LUA_OPUNM = 12,
308 	LUA_OPBNOT = 13,
309 }
310 
311 
312 enum {
313 	/// stfu
314 	LUA_OPEQ = 0, ///
315 	LUA_OPLT = 1, ///
316 	LUA_OPLE = 2, ///
317 }
318 
319 
320 /** garbage-collection function and options */
321 enum {
322 	LUA_GCSTOP = 0, /** stops the garbage collector */
323 	LUA_GCRESTART = 1, /** restarts the garbage collector */
324 	LUA_GCCOLLECT = 2, /** performs a full garbage-collection cycle */
325 
326 	/** returns the current amount of memory (in Kbytes) in use by Lua */
327 	LUA_GCCOUNT = 3,
328 
329 	/** returns the remainder of dividing the current amount of bytes of
330 	 * memory in use by Lua by 1024
331 	 */
332 	LUA_GCCOUNTB = 4,
333 
334 	/** performs an incremental step of garbage collection. The step "size"
335 	 * is controlled by data (larger values mean more steps) in a non-specified
336 	 * way. If you want to control the step size you must experimentally tune
337 	 * the value of data. The function returns 1 if the step finished a
338 	 * garbage-collection cycle
339 	 */
340 	LUA_GCSTEP = 5,
341 
342 	/** sets data as the new value for the pause of the collector.
343 	 * The function returns the previous value of the pause
344 	 */
345 	LUA_GCSETPAUSE = 6,
346 
347 	/** sets data as the new value for the step multiplier of the collector.
348 	 * The function returns the previous value of the step multiplier.
349 	 */
350 	LUA_GCSETSTEPMUL = 7,
351 
352 	/// stfu
353 	LUA_GCISRUNNING = 9, ///
354 	LUA_GCGEN = 10, ///
355 	LUA_GCINC = 11, ///
356 }
357 
358 
359 /** Event codes */
360 enum {
361 	LUA_HOOKCALL = 0, /** call hook */
362 	LUA_HOOKRET = 1, /** return hook */
363 	LUA_HOOKLINE = 2, /** line hook */
364 	LUA_HOOKCOUNT = 3, /** count hook */
365 	LUA_HOOKTAILCALL = 4, /** tail call hook */
366 }
367 
368 
369 /** Event masks */
370 enum {
371 	LUA_MASKCALL = 1 << LUA_HOOKCALL, /** call mask */
372 	LUA_MASKRET = 1 << LUA_HOOKRET, /** return mask */
373 	LUA_MASKLINE = 1 << LUA_HOOKLINE, /** line mask */
374 	LUA_MASKCOUNT = 1 << LUA_HOOKCOUNT, /** count mask */
375 }
376 
377 /** Max debug function description
378  *
379  * Gives the maximum size for the description of the source
380  * of a function in debug information.
381  */
382 enum LUA_IDSIZE = 60;
383 
384 struct lua_Debug {
385 	int event;
386 	const char* name;
387 	const char* namewhat;
388 	const char* what;
389 	const char* source;
390 	size_t srclen;
391 	int currentline;
392 	int linedefined;
393 	int lastlinedefined;
394 	byte nups;
395 	byte params;
396 	char isvararg;
397 	char istailcall;
398 	/// index of the first transferred value
399 	ushort ftransfer;
400 	/// number of transferred values
401 	ushort ntransfer;
402 	char[LUA_IDSIZE] short_src;
403 
404 private:
405 	struct CallInfo;
406 	CallInfo* i_ci; /* active function */
407 }
408 
409 extern(C) nothrow alias lua_Hook = void function(lua_State*, lua_Debug*);
410 
411 
412 struct luaL_Reg
413 {
414 	const(char)* name;
415 	lua_CFunction func;
416 }
417 
418 enum LUAL_NUMSIZES = (lua_Integer.sizeof * 16) + lua_Number.sizeof;
419 
420 enum LUA_NOREF = -2;
421 enum int LUA_REFNIL = -1;
422 
423 struct luaL_Buffer {
424 	char* b;
425 	size_t size;
426 	size_t n;
427 	lua_State* L;
428 	char[] initb;
429 }
430 
431 struct luaL_Stream;
432 
433 enum : string {
434 	LUA_COLIBNAME = "coroutine",
435 	LUA_TABLIBNAME = "table",
436 	LUA_IOLIBNAME = "io",
437 	LUA_OSLIBNAME = "os",
438 	LUA_STRLIBNAME = "string",
439 	LUA_UTF8LIBNAME = "utf8",
440 	LUA_BITLIBNAME = "bit32",
441 	LUA_MATHLIBNAME = "math",
442 	LUA_DBLIBNAME = "debug",
443 	LUA_LOADLIBNAME = "package",
444 }
445 
446 version(RiverD_Lua_Static) {
447 	import riverd.lua.statfun;
448 } else {
449 	import riverd.lua.dynfun;
450 }
451 
452 @nogc nothrow {
453 	ptrdiff_t lua_getextraspace(lua_State* L) {
454 		return cast(ptrdiff_t)(cast(void*)L - LUA_EXTRASPACE);
455 	}
456 
457 	void lua_call(lua_State* L, int nargs, int nresults) {
458 		lua_callk(L, nargs, nresults, 0, null);
459 	}
460 
461 	int lua_pcall(lua_State* L, int nargs, int nresults, int errfunc) {
462 		return lua_pcallk(L, nargs, nresults, errfunc, 0, null);
463 	}
464 
465 	int lua_yield(lua_State* L, int nresults) {
466 		return lua_yieldk(L, nresults, 0, null);
467 	}
468 
469 	lua_Number lua_tonumber(lua_State* L, int i) {
470 		return lua_tonumberx(L, i, null);
471 	}
472 
473 	lua_Integer lua_tointeger(lua_State* L, int i) {
474 		return lua_tointegerx(L, i, null);
475 	}
476 
477 	void lua_pop(lua_State* L, int idx) {
478 		lua_settop(L, (-idx)-1);
479 	}
480 
481 	void lua_newtable(lua_State* L) {
482 		lua_createtable(L, 0, 0);
483 	}
484 
485 	void lua_register(lua_State* L, const(char)* n, lua_CFunction f) {
486 		lua_pushcfunction(L, f);
487 		lua_setglobal(L, n);
488 	}
489 
490 	void lua_pushcfunction(lua_State* L, lua_CFunction f) {
491 		lua_pushcclosure(L, f, 0);
492 	}
493 
494 	bool lua_isfunction(lua_State* L, int idx) {
495 		return lua_type(L, idx) == LUA_TFUNCTION;
496 	}
497 
498 	bool lua_istable(lua_State* L, int idx) {
499 		return lua_type(L, idx) == LUA_TTABLE;
500 	}
501 
502 	bool lua_islightuserdata(lua_State* L, int idx) {
503 		return lua_type(L, idx) == LUA_TLIGHTUSERDATA;
504 	}
505 
506 	bool lua_isnil(lua_State* L, int idx) {
507 		return lua_type(L, idx) == LUA_TNIL;
508 	}
509 
510 	bool lua_isboolean(lua_State* L, int idx) {
511 		return lua_type(L, idx) == LUA_TBOOLEAN;
512 	}
513 
514 	bool lua_isthread(lua_State* L, int idx) {
515 		return lua_type(L, idx) == LUA_TTHREAD;
516 	}
517 
518 	bool lua_isnone(lua_State* L, int idx) {
519 		return lua_type(L, idx) == LUA_TNONE;
520 	}
521 
522 	bool lua_isnoneornil(lua_State* L, int idx) {
523 		return lua_type(L, idx) <= 0;
524 	}
525 
526 	const(char)* lua_pushliteral(lua_State* L, string s) {
527 		return lua_pushstring(L, s.ptr);
528 	}
529 
530 	void lua_pushglobaltable(lua_State* L) {
531 		lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
532 	}
533 
534 	const(char)* lua_tostring(lua_State* L, int idx) {
535 		return lua_tolstring(L, idx, null);
536 	}
537 
538 	void lua_insert(lua_State* L, int idx) {
539 		lua_rotate(L, idx, 1);
540 	}
541 
542 	void lua_remove(lua_State* L, int idx) {
543 		lua_rotate(L, idx, -1);
544 		lua_pop(L, 1);
545 	}
546 
547 	void lua_replace(lua_State* L, int idx) {
548 		lua_copy(L, -1, idx);
549 		lua_pop(L, 1);
550 	}
551 
552 	void luaL_checkversion(lua_State* L) {
553 		luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES);
554 	}
555 
556 	int luaL_loadfile(lua_State* L, const(char)* f) {
557 		return luaL_loadfilex(L, f, null);
558 	}
559 
560 	void luaL_newlibtable(lua_State* L, const(luaL_Reg)[] l) {
561 		lua_createtable(L, 0, cast(int)(l.length) - 1);
562 	}
563 
564 	void luaL_newlib(lua_State* L, luaL_Reg[] l) {
565 		luaL_checkversion(L);
566 		luaL_newlibtable(L, l);
567 		luaL_setfuncs(L, l.ptr, 0);
568 	}
569 
570 	const(char)* luaL_checkstring(lua_State* L, int n) {
571 		return luaL_checklstring(L, n, null);
572 	}
573 
574 	const(char)* luaL_optstring(lua_State* L, int n, const(char)* d) {
575 		return luaL_optlstring(L, n, d, null);
576 	}
577 
578 
579 	/**
580 	 *
581 	 * Returns: the name of the type of the value at the given index.
582 	 */
583 	pragma(inline)
584 	const(char)* luaL_typename(lua_State* L, int i) {
585 		return lua_typename(L, lua_type(L,i));
586 	}
587 
588 
589 	/** Loads and runs the given file.
590 	*
591 	* It is definend by a macro.
592 	*
593 	* Returns: 0 if there are no errors or 1 in case of errors.
594 	*/
595 	pragma(inline)
596 	int luaL_dofile(lua_State* L, const(char)* fn) {
597 		luaL_loadfile(L, fn);
598 		return lua_pcall(L, 0, LUA_MULTRET, 0);
599 	}
600 
601 
602 	/** Loads and runs the given string.
603 	 *
604 	 * It is defined by a macro.
605 	 *
606 	 * Returns: false if there are no errors or true in case of errors.
607 	 */
608 	pragma(inline)
609 	int luaL_dostring(lua_State* L, const(char)* s) {
610 		luaL_loadstring(L, s);
611 		return lua_pcall(L, 0, LUA_MULTRET, 0);
612 	}
613 
614 
615 	/** Pushes onto the stack the metatable associated with name tname in the registry.
616 	 *
617 	 * Returns: the type of the pushed value (nil if there is no metatable associated with that name)
618 	 *
619 	 * See_Also: $(LREF luaL_newmetatable)
620 	 */
621 	pragma(inline)
622 	void luaL_getmetatable(lua_State* L, const(char)* n) {
623 		lua_getfield(L, LUA_REGISTRYINDEX, n);
624 	}
625 
626 
627 	/** Equivalent to luaL_loadbufferx with mode equal to NULL. */
628 	pragma(inline)
629 	int luaL_loadbuffer(lua_State* L, const(char)* s, size_t sz, const(char)* n) {
630 		return luaL_loadbufferx(L, s, sz, n, null);
631 	}
632 
633 	pragma(inline)
634 	void* lua_newuserdata(lua_State* L, size_t s) {
635 		return lua_newuserdatauv(L, s, 1);
636 	}
637 
638 	pragma(inline)
639 	int lua_getuservalue(lua_State* L, int idx) {
640 		return lua_getiuservalue(L, idx, 1);
641 	}
642 
643 	pragma(inline)
644 	void lua_setuservalue(lua_State* L, int idx) {
645 		lua_newuserdatauv(L, idx, 1);
646 	}
647 }
648 
649 
650 extern(C) @nogc nothrow {
651 	alias da_lua_newstate = lua_State* function(lua_Alloc, void*); ///
652 	alias da_lua_close = void function(lua_State*); ///
653 	alias da_lua_newthread = lua_State* function(lua_State*); ///
654 	alias da_lua_resetthread = int function(lua_State *); ///
655 	alias da_lua_atpanic = lua_CFunction function(lua_State*, lua_CFunction); ///
656 	alias da_lua_version = lua_Number function(lua_State*); ///
657 	alias da_lua_absindex = int function(lua_State*, int); ///
658 	alias da_lua_gettop = int function(lua_State*); ///
659 	alias da_lua_settop = void function(lua_State*, int); ///
660 	alias da_lua_pushvalue = void function(lua_State*, int); ///
661 	alias da_lua_rotate = void function(lua_State*, int, int); ///
662 	alias da_lua_copy = void function(lua_State*, int, int); ///
663 	alias da_lua_checkstack = int function(lua_State*, int); ///
664 	alias da_lua_xmove = void function(lua_State*, lua_State*, int); ///
665 	alias da_lua_isnumber = int function(lua_State*, int); ///
666 	alias da_lua_isstring = int function(lua_State*, int); ///
667 	alias da_lua_iscfunction = int function(lua_State*, int); ///
668 	alias da_lua_isinteger = int function(lua_State*, int); ///
669 	alias da_lua_isuserdata = int function(lua_State*, int); ///
670 	alias da_lua_type = int function(lua_State*, int); ///
671 	alias da_lua_typename = const(char)* function(lua_State*, int); ///
672 	alias da_lua_tonumberx = lua_Number function(lua_State*, int, int*); ///
673 	alias da_lua_tointegerx = lua_Integer function(lua_State*, int, int*); ///
674 	alias da_lua_toboolean = int function(lua_State*, int); ///
675 	alias da_lua_tolstring = const(char)* function(lua_State*, int, size_t*); ///
676 	alias da_lua_rawlen = lua_Unsigned function(lua_State*, int); ///
677 	alias da_lua_tocfunction = lua_CFunction function(lua_State*, int); ///
678 	alias da_lua_touserdata = void* function(lua_State*, int); ///
679 	alias da_lua_tothread = lua_State* function(lua_State*, int); ///
680 	alias da_lua_topointer = const(void)* function(lua_State*, int); ///
681 	alias da_lua_arith = void function(lua_State*, int); ///
682 	alias da_lua_rawequal = int function(lua_State*, int, int); ///
683 	alias da_lua_compare = int function(lua_State*, int, int, int); ///
684 	alias da_lua_pushnil = void function(lua_State*); ///
685 	alias da_lua_pushnumber = void function(lua_State*, lua_Number); ///
686 	alias da_lua_pushinteger = void function(lua_State*, lua_Integer); ///
687 	alias da_lua_pushlstring = const(char)* function(lua_State*, const(char)*, size_t); ///
688 	alias da_lua_pushstring = const(char)* function(lua_State*, const(char)*); ///
689 	alias da_lua_pushvfstring = const(char)* function(lua_State*, const(char)*, va_list); ///
690 	alias da_lua_pushfstring = const(char)* function(lua_State*, const(char)*, ...); ///
691 	alias da_lua_pushcclosure = void function(lua_State*, lua_CFunction, int); ///
692 	alias da_lua_pushboolean = void function(lua_State*, int); ///
693 	alias da_lua_pushlightuserdata = void function(lua_State*, void*); ///
694 	alias da_lua_pushthread = int function(lua_State*); ///
695 	alias da_lua_getglobal = int function(lua_State*, const(char)*); ///
696 	alias da_lua_gettable = int function(lua_State*, int); ///
697 	alias da_lua_getfield = int function(lua_State*, int, const(char)*); ///
698 	alias da_lua_geti = int function(lua_State*, int, lua_Integer); ///
699 	alias da_lua_rawget = int function(lua_State*, int); ///
700 	alias da_lua_rawgeti = int function(lua_State*, int, int); ///
701 	alias da_lua_rawgetp = int function(lua_State*, int, const(void)*); ///
702 	alias da_lua_createtable = void function(lua_State*, int, int); ///
703 	alias da_lua_newuserdatauv = void* function(lua_State*, size_t, int); ///
704 	alias da_lua_getmetatable = int function(lua_State*, int); ///
705 	alias da_lua_getiuservalue = int function(lua_State*, int, int); ///
706 	alias da_lua_setglobal = void function(lua_State*, const(char)*); ///
707 	alias da_lua_settable = void function(lua_State*, int); ///
708 	alias da_lua_setfield = void function(lua_State*, int, const(char)*); ///
709 	alias da_lua_rawset = void function(lua_State*, int); ///
710 	alias da_lua_rawseti = void function(lua_State*, int, lua_Integer); ///
711 	alias da_lua_rawsetp = void function(lua_State*, int, const(void)*); ///
712 	alias da_lua_setmetatable = int function(lua_State*, int); ///
713 	alias da_lua_setiuservalue = void function(lua_State*, int, int); ///
714 	alias da_lua_callk = void function(lua_State*, int, int, lua_KContext, lua_KFunction); ///
715 	alias da_lua_pcallk = int function(lua_State*, int, int, int, lua_KContext, lua_KFunction); ///
716 	alias da_lua_load = int function(lua_State*, lua_Reader, void*, const(char)*, const(char)*); ///
717 	alias da_lua_dump = int function(lua_State*, lua_Writer, void*, int); ///
718 	alias da_lua_yieldk = int function(lua_State*, int, lua_KContext, lua_KFunction); ///
719 	alias da_lua_resume = int function(lua_State*, lua_State*, int, int*); ///
720 	alias da_lua_status = int function(lua_State*); ///
721 	alias da_lua_isyieldable = int function(lua_State*); ///
722 	alias da_lua_setwarnf = void function(lua_State*, lua_WarnFunction, void *); ///
723 	alias da_lua_warning = void function(lua_State*, const char*, int); ///
724 	alias da_lua_gc = int function(lua_State*, int, ...); ///
725 	alias da_lua_error = int function(lua_State*); ///
726 	alias da_lua_next = int function(lua_State*, int); ///
727 	alias da_lua_concat = void function(lua_State*, int); ///
728 	alias da_lua_len = void function(lua_State*, int); ///
729 	alias da_lua_stringtonumber = size_t function(lua_State*, const(char)*); ///
730 	alias da_lua_getallocf = lua_Alloc function(lua_State*, void**); ///
731 	alias da_lua_setallocf = void function(lua_State*, lua_Alloc, void*); ///
732 	alias da_lua_toclose = void function(lua_State*, int); ///
733 	alias da_lua_getstack = int function(lua_State*, int, lua_Debug*); ///
734 	alias da_lua_getinfo = int function(lua_State*, const(char)*, lua_Debug*); ///
735 	alias da_lua_getlocal = const(char)* function(lua_State*, const(lua_Debug)*, int); ///
736 	alias da_lua_setlocal = const(char)* function(lua_State*, const(lua_Debug)*, int); ///
737 	alias da_lua_getupvalue = const(char)* function(lua_State*, int, int); ///
738 	alias da_lua_setupvalue = const(char)* function(lua_State*, int, int); ///
739 	alias da_lua_upvalueid = void* function(lua_State*, int, int); ///
740 	alias da_lua_upvaluejoin = void function(lua_State*, int, int, int, int); ///
741 	alias da_lua_sethook = void function(lua_State*, lua_Hook, int, int); ///
742 	alias da_lua_gethook = lua_Hook function(lua_State*); ///
743 	alias da_lua_gethookmask = int function(lua_State*); ///
744 	alias da_lua_gethookcount = int function(lua_State*); ///
745 	alias da_lua_setcstacklimit = int function(lua_State*, uint); ///
746 
747 	alias da_luaL_checkversion_ = void function(lua_State*, lua_Number, size_t); ///
748 	alias da_luaL_getmetafield = int function(lua_State*, int, const(char)*); ///
749 	alias da_luaL_callmeta = int function(lua_State*, int, const(char)*); ///
750 	alias da_luaL_tolstring = const(char)* function(lua_State*, int, size_t*); ///
751 	alias da_luaL_argerror = int function(lua_State*, int, const(char)*); ///
752 	alias da_luaL_checklstring = const(char)* function(lua_State*, int, size_t*); ///
753 	alias da_luaL_optlstring = const(char)* function(lua_State*, int, const(char)*, size_t*); ///
754 	alias da_luaL_checknumber = lua_Number function(lua_State*, int); ///
755 	alias da_luaL_optnumber = lua_Number function(lua_State*, int, lua_Number); ///
756 	alias da_luaL_checkinteger = lua_Integer function(lua_State*, int); ///
757 	alias da_luaL_optinteger = lua_Integer function(lua_State*, int, lua_Integer); ///
758 	alias da_luaL_checkstack = void function(lua_State*, int, const(char)*); ///
759 	alias da_luaL_checktype = void function(lua_State*, int, int); ///
760 	alias da_luaL_checkany = void function(lua_State*, int); ///
761 	alias da_luaL_newmetatable = int function(lua_State*, const(char)*); ///
762 	alias da_luaL_setmetatable = void function(lua_State*, const(char)*); ///
763 	alias da_luaL_testudata = void* function(lua_State*, int, const(char)*); ///
764 	alias da_luaL_checkudata = void* function(lua_State*, int, const(char)*); ///
765 	alias da_luaL_where = void function(lua_State*, int); ///
766 	alias da_luaL_error = int function(lua_State*, const(char)*, ...); ///
767 	alias da_luaL_checkoption = int function(lua_State*, int, const(char)*); ///
768 	alias da_luaL_fileresult = int function(lua_State*, int, const(char)*); ///
769 	alias da_luaL_execresult = int function(lua_State*, int); ///
770 	alias da_luaL_ref = int function(lua_State*, int); ///
771 	alias da_luaL_unref = void function(lua_State*, int, int); ///
772 	alias da_luaL_loadfilex = int function(lua_State*, const(char)*, const(char)*); ///
773 	alias da_luaL_loadbufferx = int function(lua_State*, const(char)*, size_t, const(char)*, const(char)*); ///
774 	alias da_luaL_loadstring = int function(lua_State*, const(char)*); ///
775 	alias da_luaL_newstate = lua_State* function(); ///
776 	alias da_luaL_len = lua_Integer function(lua_State*, int); ///
777 	alias da_luaL_gsub = const(char)* function(lua_State*, const(char)*, const(char)*, const(char)*); ///
778 	alias da_luaL_setfuncs = void function(lua_State*, const luaL_Reg*, int); ///
779 	alias da_luaL_getsubtable = int function(lua_State*, int, const(char)*); ///
780 	alias da_luaL_traceback = void function(lua_State*, lua_State*, const(char)*, int); ///
781 	alias da_luaL_requiref = void function(lua_State*, const(char)*, lua_CFunction, int); ///
782 	alias da_luaL_buffinit = void function(lua_State*, luaL_Buffer*); ///
783 	alias da_luaL_prepbuffsize = char* function(luaL_Buffer*, size_t); ///
784 	alias da_luaL_addlstring = void function(luaL_Buffer*, const(char)*, size_t); ///
785 	alias da_luaL_addstring = void function(luaL_Buffer*, const(char)*); ///
786 	alias da_luaL_addvalue = void function(luaL_Buffer*); ///
787 	alias da_luaL_pushresult = void function(luaL_Buffer*); ///
788 	alias da_luaL_pushresultsize = void function(luaL_Buffer*, size_t); ///
789 	alias da_luaL_buffinitsize = char* function(lua_State*, luaL_Buffer*, size_t); ///
790 	alias da_luaL_pushmodule = void function(lua_State*, const(char)*, int); ///
791 	alias da_luaL_openlib = void function(lua_State*, const(char)*, const(luaL_Reg)*, int); ///
792 
793 	alias da_luaopen_base = int function(lua_State*); ///
794 	alias da_luaopen_coroutine = int function(lua_State*); ///
795 	alias da_luaopen_table = int function(lua_State*); ///
796 	alias da_luaopen_io = int function(lua_State*); ///
797 	alias da_luaopen_os = int function(lua_State*); ///
798 	alias da_luaopen_string = int function(lua_State*); ///
799 	alias da_luaopen_utf8 = int function(lua_State*); ///
800 	alias da_luaopen_bit32 = int function(lua_State*); ///
801 	alias da_luaopen_math = int function(lua_State*); ///
802 	alias da_luaopen_debug = int function(lua_State*); ///
803 	alias da_luaopen_package = int function(lua_State*); ///
804 	alias da_luaL_openlibs = void function(lua_State*); ///
805 }