How do I get my own gamemode folders with file.find?
3 replies, posted
I am trying to use [I]file.find[/I] to search a custom made folder inside of my gamemode.
Folder I want to access:
[I]garrysmod/gamemodes/CommunityRoleplay/mods/[/I]
Code I am using:
[lua]
local files, dirs = file.find( "gamemodes/CommunityRoleplay/mods/*", "GAME" )
[/lua]
Although this does not work because [I]file.find[/I] does not seem to get the actual folders inside [I]garrysmod/gamemodes/[/I], but still returns the files inside of the [I]gamemodes/[/I] folder.
I have tried using all of these:
[quote]
"GAME" Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)
"LUA" or "lsv" - All Lua folders (lua/) including gamesmodes and addons
"DATA" Data folder (garrysmod/data)
"MOD" Strictly the game folder (garrysmod/), ignores mounting.
[/quote]
But none seem to get the actual folders inside of [I]garrysmod/gamemodes/[/I].
The code you posted should work - if it doesn't then something is going wrong internally somewhere
[QUOTE=find me;39978549]I am trying to use [I]file.find[/I] to search a custom made folder inside of my gamemode.
Folder I want to access:
[I]garrysmod/gamemodes/CommunityRoleplay/mods/[/I]
Code I am using:
[lua]
local files, dirs = file.find( "gamemodes/CommunityRoleplay/mods/*", "GAME" )
[/lua]
Although this does not work because [I]file.find[/I] does not seem to get the actual folders inside [I]garrysmod/gamemodes/[/I], but still returns the files inside of the [I]gamemodes/[/I] folder.
I have tried using all of these:
But none seem to get the actual folders inside of [I]garrysmod/gamemodes/[/I].[/QUOTE]
find ~= Find
[lua]> local files, dirs = file.Find( "gamemodes/*", "GAME" ) PrintTable(dirs)...
1 = base
2 = sandbox
3 = terrortown
4 = zmod
> local files, dirs = file.Find( "gamemodes/sandbox/*", "GAME" ) PrintTable(dirs)...
1 = entities
2 = gamemode
[/lua]
[QUOTE=RetTurtl3;39979015]find ~= Find
[lua]> local files, dirs = file.Find( "gamemodes/*", "GAME" ) PrintTable(dirs)...
1 = base
2 = sandbox
3 = terrortown
4 = zmod
> local files, dirs = file.Find( "gamemodes/sandbox/*", "GAME" ) PrintTable(dirs)...
1 = entities
2 = gamemode
[/lua][/QUOTE]
Oh thank you! The notepad syntax highlighter confused me on that one.
Sorry, you need to Log In to post a reply to this thread.