seqlua

view seqlua_c_example.c @ 24:28d472cc7a9b

Removed seqlua_iterclosure header in seqlualib.h
author jbe
date Thu Aug 21 20:20:20 2014 +0200 (2014-08-21)
parents 29792283522f
children 44880bcfc323
line source
1 #include <lua.h>
2 #include <lauxlib.h>
3 #include "seqlualib.h"
4 #include <stdio.h>
6 static int seqlua_c_example_printcsv(lua_State *L) {
7 seqlua_Iterator iter;
8 seqlua_iterloop(L, &iter, 1) {
9 if (seqlua_itercount(&iter) > 1) fputs(",", stdout);
10 fputs(luaL_tolstring(L, -1, NULL), stdout);
11 lua_pop(L, 1); // pop value that luaL_tolstring pushed onto stack
12 }
13 fputs("\n", stdout);
14 return 0;
15 }
17 int luaopen_seqlua_c_example(lua_State *L) {
18 lua_pushcfunction(L, seqlua_c_example_printcsv);
19 lua_setglobal(L, "printcsv");
20 return 0;
21 }

Impressum / About Us