seqlua

diff seqlualib.h @ 0:47f9b323d68c

Initial commit
author jbe
date Wed Aug 20 00:39:10 2014 +0200 (2014-08-20)
parents
children 144f0bddee2b
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/seqlualib.h	Wed Aug 20 00:39:10 2014 +0200
     1.3 @@ -0,0 +1,24 @@
     1.4 +#include <lua.h>
     1.5 +#include <lauxlib.h>
     1.6 +
     1.7 +typedef struct {
     1.8 +  lua_State *L;
     1.9 +  int itertype;
    1.10 +  lua_Integer i;
    1.11 +} seqlua_Iterator;
    1.12 +
    1.13 +extern void seqlua_iterinit(lua_State *L, seqlua_Iterator *iter, int idx);
    1.14 +
    1.15 +extern int seqlua_iternext(seqlua_Iterator *iter);
    1.16 +
    1.17 +#define seqlua_iterloop(L, iter, idx) \
    1.18 +  for ( \
    1.19 +    seqlua_iterinit((L), (iter), (idx)); \
    1.20 +    seqlua_iternext(iter); \
    1.21 +    lua_pop((L), 1) \
    1.22 +  )
    1.23 +
    1.24 +#define seqlua_itercount(iter) ((iter)->i)
    1.25 +
    1.26 +extern void seqlua_iterclosure(lua_State *L, int idx);
    1.27 +

Impressum / About Us