mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-22 02:53:06 +00:00
Merge pull request #45 from moteus/master
Fix. Compile with MSVC and with gcc without `-std=c99`
This commit is contained in:
@@ -438,6 +438,7 @@ static int make_dir (lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Removes a directory.
|
||||
** @param #1 Directory path.
|
||||
@@ -457,6 +458,7 @@ static int remove_dir (lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Directory iterator
|
||||
*/
|
||||
@@ -569,6 +571,7 @@ static int dir_create_meta (lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Creates lock metatable.
|
||||
*/
|
||||
@@ -790,6 +793,7 @@ struct _stat_members members[] = {
|
||||
static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) {
|
||||
STAT_STRUCT info;
|
||||
const char *file = luaL_checkstring (L, 1);
|
||||
int i;
|
||||
|
||||
if (st(file, &info)) {
|
||||
lua_pushnil (L);
|
||||
@@ -798,7 +802,7 @@ static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) {
|
||||
}
|
||||
if (lua_isstring (L, 2)) {
|
||||
const char *member = lua_tostring (L, 2);
|
||||
for (int i = 0; members[i].name; i++) {
|
||||
for (i = 0; members[i].name; i++) {
|
||||
if (strcmp(members[i].name, member) == 0) {
|
||||
/* push member value and return */
|
||||
members[i].push (L, &info);
|
||||
@@ -813,7 +817,7 @@ static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) {
|
||||
lua_newtable (L);
|
||||
}
|
||||
/* stores all members in table on top of the stack */
|
||||
for (int i = 0; members[i].name; i++) {
|
||||
for (i = 0; members[i].name; i++) {
|
||||
lua_pushstring (L, members[i].name);
|
||||
members[i].push (L, &info);
|
||||
lua_rawset (L, -3);
|
||||
|
||||
Reference in New Issue
Block a user