aboutsummaryrefslogtreecommitdiff
path: root/nerv.c
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-25 16:20:50 +0800
committerDeterminant <[email protected]>2015-05-25 16:20:50 +0800
commit7dadb31a364c3dbe30c05c9a9040c48f1d4a9095 (patch)
tree6be00c4735f66e478d41936accaefb857b0f431e /nerv.c
parentf6c23565901561cfe1d7c3c29266ee60ce1f7bdd (diff)
add comments to nerv.c
Diffstat (limited to 'nerv.c')
-rw-r--r--nerv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/nerv.c b/nerv.c
index d586867..0bc661e 100644
--- a/nerv.c
+++ b/nerv.c
@@ -17,8 +17,18 @@ void nerv_utils_init(lua_State *L) {
int luaopen_libnerv(lua_State *L) {
lua_newtable(L);
+ /* duplicate table */
lua_pushvalue(L, -1);
+ /* set table to global index */
lua_setfield(L, LUA_GLOBALSINDEX, "nerv");
+ /* A table reference still remains.
+ *
+ * The following initialization functions should obey to the rule that they
+ * maintain the stack properly to guarantee the stack stays the same before
+ * and after invoking the call (i.e. stay balanced).
+ *
+ * Also note that they can make use of the value at top of the stack which
+ * references to the `nerv` global table. */
nerv_utils_init(L);
nerv_point_init(L);
nerv_matrix_init(L);