1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include <lua.h>
#include <lauxlib.h>
#include <GLFW/glfw3.h>
#include "util/util.h"
#include "setup.h"
#define X(str, mt) const char *glfw_ ## mt ## _tname = str;
H_GLFW_METATABLES
#undef X
void setup_glfw(lua_State *L, int honey_tbl)
{
/* create metatables */
#define X(str, mt) luaL_newmetatable(L, glfw_ ## mt ## _tname); lua_pop(L, 1);
H_GLFW_METATABLES
#undef X
struct honey_tbl_t tbl[] = {
#define X(name, val) H_INT(name, val),
H_GLFW_ENUM
#undef X
#define X(name, func) H_FUNC(name, func),
H_GLFW_FUNCTIONS
#undef X
H_END
};
create_table(L, tbl);
int t = lua_gettop(L);
GLFWwindow ** window_null = create_window(L);
*window_null = NULL;
lua_setfield(L, t, "window_NULL");
GLFWmonitor ** monitor_null = create_monitor(L);
*monitor_null = NULL;
lua_setfield(L, t, "monitor_NULL");
lua_setfield(L, honey_tbl, "glfw");
}
|