seqlua

view seqlua_c_example.c @ 54:92ce3958aca7

Reverted last two commits
author jbe
date Wed Aug 27 00:10:47 2014 +0200 (2014-08-27)
parents 3362ec36cb09
children
line source
1 #include <lua.h>
2 #include <lauxlib.h>
3 #include <seqlualib.h>
4 #include <stdio.h>
6 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 // two values need to be popped (the value pushed by
12 // seqlua_iternext and the value pushed by luaL_tolstring)
13 lua_pop(L, 2);
14 }
15 fputs("\n", stdout);
16 return 0;
17 }
19 int luaopen_seqlua_c_example(lua_State *L) {
20 lua_pushcfunction(L, seqlua_c_example_printcsv);
21 lua_setglobal(L, "printcsv");
22 return 0;
23 }

Impressum / About Us