seqlua

view seqlua_c_example.c @ 4:44eddb9cea1e

Fixed mistake in README: seqlua_iterclosure(L, idx) respects __call, not __ipairs
author jbe
date Wed Aug 20 01:44:13 2014 +0200 (2014-08-20)
parents 47f9b323d68c
children 144f0bddee2b
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);
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