seqlua
diff seqlua_c_example.c @ 25:44880bcfc323
Macro seqlua_iterloop doesn't automatically pop the value anymore (use seqlua_iterloopauto instead); New function string.concat(sep, seq) introduced
author | jbe |
---|---|
date | Thu Aug 21 21:32:01 2014 +0200 (2014-08-21) |
parents | 29792283522f |
children | 45855c3e5cb8 |
line diff
1.1 --- a/seqlua_c_example.c Thu Aug 21 20:20:20 2014 +0200 1.2 +++ b/seqlua_c_example.c Thu Aug 21 21:32:01 2014 +0200 1.3 @@ -3,12 +3,14 @@ 1.4 #include "seqlualib.h" 1.5 #include <stdio.h> 1.6 1.7 -static int seqlua_c_example_printcsv(lua_State *L) { 1.8 +int seqlua_c_example_printcsv(lua_State *L) { 1.9 seqlua_Iterator iter; 1.10 seqlua_iterloop(L, &iter, 1) { 1.11 if (seqlua_itercount(&iter) > 1) fputs(",", stdout); 1.12 fputs(luaL_tolstring(L, -1, NULL), stdout); 1.13 - lua_pop(L, 1); // pop value that luaL_tolstring pushed onto stack 1.14 + // two values need to be popped (the value pushed by 1.15 + // seqlua_iternext and the value pushed by luaL_tolstring) 1.16 + lua_pop(L, 2); 1.17 } 1.18 fputs("\n", stdout); 1.19 return 0;