Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Lua I/O test

  • Loading branch information...
commit db24317a156ccc1d20383ec3619c4c2a05fd9367 1 parent 07ab4d2
Sébastien Bourdeauducq sbourdeauducq authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 main.c
16 main.c
View
@@ -11,15 +11,20 @@
#include <lauxlib.h>
#include <lualib.h>
+//#define TEST_BASIC
+//#define TEST_DIR
+#define TEST_FILE
+
static void test_lua(void)
{
lua_State *L;
- // /patchpool/nil - Cid and Lucy.fnp
-
L = luaL_newstate();
luaL_openlibs(L);
+#ifdef TEST_BASIC
luaL_dostring(L, "for i=10,1,-1 do print(i) end\n");
+#endif
+#ifdef TEST_DIR
luaL_dostring(L, "function attrdir (path)\n"
" for file in lfs.dir(path) do\n"
" if file ~= \".\" and file ~= \"..\" then\n"
@@ -39,6 +44,13 @@ static void test_lua(void)
"end\n"
"\n"
"attrdir (\"/\")\n");
+#endif
+#ifdef TEST_FILE
+ luaL_dostring(L, "f = assert(io.open(\"/patchpool/nil - Cid and Lucy.fnp\"))\n"
+ "t = f:read(\"*all\")\n"
+ "print(t)\n"
+ "f:close()\n");
+#endif
lua_close(L);
}
Please sign in to comment.
Something went wrong with that request. Please try again.