equal
deleted
inserted
replaced
18 #include "lauxlib.h" |
18 #include "lauxlib.h" |
19 #include "lualib.h" |
19 #include "lualib.h" |
20 |
20 |
21 |
21 |
22 |
22 |
23 #define IO_INPUT 1 |
23 #define IO_INPUT 1 |
24 #define IO_OUTPUT 2 |
24 #define IO_OUTPUT 2 |
25 |
25 |
26 |
26 |
27 static const char *const fnames[] = {"input", "output"}; |
27 static const char *const fnames[] = {"input", "output"}; |
28 |
28 |
29 |
29 |
49 lua_pushfstring(L, "%s: %s", filename, strerror(errno)); |
49 lua_pushfstring(L, "%s: %s", filename, strerror(errno)); |
50 luaL_argerror(L, arg, lua_tostring(L, -1)); |
50 luaL_argerror(L, arg, lua_tostring(L, -1)); |
51 } |
51 } |
52 |
52 |
53 |
53 |
54 #define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) |
54 #define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) |
55 |
55 |
56 |
56 |
57 static int io_type (lua_State *L) { |
57 static int io_type (lua_State *L) { |
58 void *ud; |
58 void *ud; |
59 luaL_checkany(L, 1); |
59 luaL_checkany(L, 1); |