jbe@0: #include jbe@0: #include jbe@50: #include jbe@0: #include jbe@0: jbe@25: int seqlua_c_example_printcsv(lua_State *L) { jbe@0: seqlua_Iterator iter; jbe@54: seqlua_iterloop(L, &iter, 1) { jbe@0: if (seqlua_itercount(&iter) > 1) fputs(",", stdout); jbe@0: fputs(luaL_tolstring(L, -1, NULL), stdout); jbe@25: // two values need to be popped (the value pushed by jbe@25: // seqlua_iternext and the value pushed by luaL_tolstring) jbe@25: lua_pop(L, 2); jbe@0: } jbe@0: fputs("\n", stdout); jbe@0: return 0; jbe@0: } jbe@0: jbe@0: int luaopen_seqlua_c_example(lua_State *L) { jbe@0: lua_pushcfunction(L, seqlua_c_example_printcsv); jbe@0: lua_setglobal(L, "printcsv"); jbe@0: return 0; jbe@0: }