Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Lua I/O test

  • Loading branch information...
commit db24317a156ccc1d20383ec3619c4c2a05fd9367 1 parent 07ab4d2
Sébastien Bourdeauducq authored

Showing 1 changed file with 14 additions and 2 deletions. Show diff stats Hide diff stats

  1. 16  main.c
16  main.c
@@ -11,15 +11,20 @@
11 11
 #include <lauxlib.h>
12 12
 #include <lualib.h>
13 13
 
  14
+//#define TEST_BASIC
  15
+//#define TEST_DIR
  16
+#define TEST_FILE
  17
+
14 18
 static void test_lua(void)
15 19
 {
16 20
 	lua_State *L;
17 21
 	
18  
-	// /patchpool/nil - Cid and Lucy.fnp
19  
-	
20 22
 	L = luaL_newstate();
21 23
 	luaL_openlibs(L);
  24
+#ifdef TEST_BASIC
22 25
 	luaL_dostring(L, "for i=10,1,-1 do print(i) end\n");
  26
+#endif
  27
+#ifdef TEST_DIR
23 28
 	luaL_dostring(L, "function attrdir (path)\n"
24 29
 "    for file in lfs.dir(path) do\n"
25 30
 "        if file ~= \".\" and file ~= \"..\" then\n"
@@ -39,6 +44,13 @@ static void test_lua(void)
39 44
 "end\n"
40 45
 "\n"
41 46
 "attrdir (\"/\")\n");
  47
+#endif
  48
+#ifdef TEST_FILE
  49
+	luaL_dostring(L, "f = assert(io.open(\"/patchpool/nil - Cid and Lucy.fnp\"))\n"
  50
+		"t = f:read(\"*all\")\n"
  51
+		"print(t)\n"
  52
+		"f:close()\n");
  53
+#endif
42 54
 	lua_close(L);
43 55
 }
44 56
 

0 notes on commit db24317

Please sign in to comment.
Something went wrong with that request. Please try again.