|
@@ -358,13 +358,24 @@ static int l_term_set_iter_init (lua_State *L)
|
|
|
*ip = 0;
|
|
|
|
|
|
lua_pushlightuserdata (L, ip);
|
|
|
- STACK_DUMP(L, "Before pushing tset next closure");
|
|
|
+ stack_dump (L, "Before pushing tset next closure");
|
|
|
lua_pushcclosure (L, term_set_iter_next, 2);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
+static int l_term_set_size (lua_State *L)
|
|
|
+{
|
|
|
+ LSUP_TermSet *ts =
|
|
|
+ *(LSUP_TermSet **)luaL_checkudata(L, 1, "LSUP.TermSet");
|
|
|
+
|
|
|
+ lua_pushinteger (L, LSUP_term_set_size (ts));
|
|
|
+
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
static int term_set_gc (lua_State *L)
|
|
|
{
|
|
|
LSUP_TermSet **ts_p = lua_touserdata (L, 1);
|
|
@@ -427,7 +438,7 @@ static int lmap_iter_next (lua_State *L)
|
|
|
*/
|
|
|
static int l_lmap_iter_init (lua_State *L)
|
|
|
{
|
|
|
- STACK_DUMP (L, "beginning of LMap iter init fn");
|
|
|
+ stack_dump (L, "beginning of LMap iter init fn");
|
|
|
LSUP_LinkMap *lm = *(LSUP_LinkMap **)luaL_checkudata(L, 1, "LSUP.LinkMap");
|
|
|
|
|
|
LSUP_LinkMapIterator **lmit_p =
|
|
@@ -438,7 +449,7 @@ static int l_lmap_iter_init (lua_State *L)
|
|
|
lua_setmetatable (L, -2);
|
|
|
|
|
|
lua_pushcclosure (L, lmap_iter_next, 1);
|
|
|
- STACK_DUMP (L, "After pushing iter closure");
|
|
|
+ stack_dump (L, "After pushing iter closure");
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
@@ -573,6 +584,8 @@ int luaopen_lsup_term (lua_State *L)
|
|
|
lua_setfield (L, -2, "__gc");
|
|
|
lua_pushcfunction (L, l_term_set_iter_init);
|
|
|
lua_setfield (L, -2, "__pairs");
|
|
|
+ lua_pushcfunction (L, l_term_set_size);
|
|
|
+ lua_setfield (L, -2, "__len");
|
|
|
|
|
|
// Link map.
|
|
|
luaL_newmetatable (L, "LSUP.LinkMap");
|