aboutsummaryrefslogtreecommitdiff
path: root/nerv.c
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2015-05-24 19:02:09 +0800
committerDeterminant <ted.sybil@gmail.com>2015-05-24 19:02:09 +0800
commit39e1834c449a55a44e95f2cfb6b24887fd3cec70 (patch)
tree272cbd5da6ad2208a86b2b7e6c960127b3cfecbe /nerv.c
parent63b529dc50ef0fc39e9279a976ab805ea9b11de7 (diff)
add nerv.class and try to let Lua class inherit from ParamFile
Diffstat (limited to 'nerv.c')
-rw-r--r--nerv.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/nerv.c b/nerv.c
index 55ae5b6..d586867 100644
--- a/nerv.c
+++ b/nerv.c
@@ -1,14 +1,25 @@
-#include "lua.h"
-#include "lauxlib.h"
-#include "lualib.h"
+#include "common.h"
extern void nerv_point_init(lua_State *L);
extern void nerv_matrix_init(lua_State *L);
extern void nerv_param_init(lua_State *L);
+static const luaL_Reg nerv_utils_methods[] = {
+ {"setmetatable", luaT_lua_setmetatable},
+ {"getmetatable", luaT_lua_getmetatable},
+ {"newmetatable", luaT_lua_newmetatable},
+ {NULL, NULL}
+};
+
+void nerv_utils_init(lua_State *L) {
+ luaL_register(L, NULL, nerv_utils_methods);
+}
+
int luaopen_libnerv(lua_State *L) {
lua_newtable(L);
+ lua_pushvalue(L, -1);
lua_setfield(L, LUA_GLOBALSINDEX, "nerv");
+ nerv_utils_init(L);
nerv_point_init(L);
nerv_matrix_init(L);
nerv_param_init(L);