diff options
author | Determinant <[email protected]> | 2015-05-24 19:02:09 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-05-24 19:02:09 +0800 |
commit | 39e1834c449a55a44e95f2cfb6b24887fd3cec70 (patch) | |
tree | 272cbd5da6ad2208a86b2b7e6c960127b3cfecbe /nerv.c | |
parent | 63b529dc50ef0fc39e9279a976ab805ea9b11de7 (diff) |
add nerv.class and try to let Lua class inherit from ParamFile
Diffstat (limited to 'nerv.c')
-rw-r--r-- | nerv.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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); |