]>
git.saurik.com Git - redis.git/blob - deps/lua/etc/min.c
2 * min.c -- a minimal Lua interpreter
3 * loads stdin only with minimal error handling.
4 * no interaction, and no standard library, only a "print" function.
12 static int print(lua_State
*L
)
18 if (i
>1) printf("\t");
19 if (lua_isstring(L
,i
))
20 printf("%s",lua_tostring(L
,i
));
21 else if (lua_isnil(L
,i
))
23 else if (lua_isboolean(L
,i
))
24 printf("%s",lua_toboolean(L
,i
) ? "true" : "false");
26 printf("%s:%p",luaL_typename(L
,i
),lua_topointer(L
,i
));
34 lua_State
*L
=lua_open();
35 lua_register(L
,"print",print
);
36 if (luaL_dofile(L
,NULL
)!=0) fprintf(stderr
,"%s\n",lua_tostring(L
,-1));