static int glob_index_table(lua_State* L) { struct _fileglob* glob = glob_checkmetatable(L, 1); lua_newtable(L); glob_index_filename_helper(L, glob); lua_setfield(L, -2, "filename"); glob_index_creation_time_helper(L, glob); lua_setfield(L, -2, "creation_time"); glob_index_access_time_helper(L, glob); lua_setfield(L, -2, "access_time"); glob_index_write_time_helper(L, glob); lua_setfield(L, -2, "write_time"); _glob_push_FILETIME(L, fileglob_CreationFILETIME(glob)); lua_setfield(L, -2, "creation_FILETIME"); _glob_push_FILETIME(L, fileglob_AccessFILETIME(glob)); lua_setfield(L, -2, "access_FILETIME"); _glob_push_FILETIME(L, fileglob_WriteFILETIME(glob)); lua_setfield(L, -2, "write_FILETIME"); glob_index_size_helper(L, glob); lua_setfield(L, -2, "size"); glob_index_is_directory_helper(L, glob); lua_setfield(L, -2, "is_directory"); glob_index_is_readonly_helper(L, glob); lua_setfield(L, -2, "is_readonly"); return 1; }
static int glob_close(lua_State *L) { struct _fileglob* glob = glob_checkmetatable(L, 1); if (glob) { fileglob_Destroy(glob); *(void **)(lua_touserdata(L, 1)) = NULL; } return 0; }
static int glob_index(lua_State *L) { lua_CFunction function; struct _fileglob* glob = glob_checkmetatable(L, 1); const char* key = luaL_checklstring( L, 2, NULL ); lua_getfield( L, lua_upvalueindex( 1 ), key ); if ( !lua_isnil( L, -1 ) ) return 1; lua_getfield( L, lua_upvalueindex( 2 ), key ); function = lua_tocfunction( L, -1 ); if ( function ) return function( L ); lua_getfield( L, lua_upvalueindex( 3 ), key ); if ( !lua_isnil( L, -1 ) ) return 1; luaL_argerror(L, 2, "improper key"); return 1; }
static int glob_index_is_readonly(lua_State* L) { return glob_index_is_readonly_helper(L, glob_checkmetatable(L, 1)); }
static int glob_index_is_directory(lua_State* L) { return glob_index_is_directory_helper(L, glob_checkmetatable(L, 1)); }
static int glob_index_size(lua_State* L) { return glob_index_size_helper(L, glob_checkmetatable(L, 1)); }
static int glob_index_write_FILETIME(lua_State* L) { return _glob_push_FILETIME(L, fileglob_WriteFILETIME(glob_checkmetatable(L, 1))); }
static int glob_index_access_FILETIME(lua_State* L){ return _glob_push_FILETIME(L, fileglob_AccessFILETIME(glob_checkmetatable(L, 1))); }
static int glob_index_creation_FILETIME(lua_State* L) { return _glob_push_FILETIME(L, fileglob_CreationFILETIME(glob_checkmetatable(L, 1))); }
static int glob_index_write_time(lua_State* L) { return glob_index_write_time_helper(L, glob_checkmetatable(L, 1)); }
static int glob_next(lua_State *L) { struct _fileglob* glob = glob_checkmetatable(L, 1); lua_pushboolean(L, fileglob_Next(glob)); return 1; }
static int glob_index_number_of_links(lua_State* L) { return glob_index_number_of_links_helper(L, glob_checkmetatable(L, 1)); }
static int glob_index_is_link(lua_State* L) { return glob_index_is_link_helper(L, glob_checkmetatable(L, 1)); }