Data Realms Fan Forums
http://forums.datarealms.com/

Listing directories in Lua
http://forums.datarealms.com/viewtopic.php?f=73&t=21072
Page 1 of 1

Author:  weegee [ Mon Jan 10, 2011 1:46 am ]
Post subject:  Listing directories in Lua

Is there any way to get the contents of a directory in CC 's Lua? I've tried to do os.execute("dir /b") but it switches window to console and this is totally unacceptable. Thanks in advance :)

Author:  mail2345 [ Mon Jan 10, 2011 2:24 am ]
Post subject:  Re: Listing directories in Lua

Maybe code up your own small program to return a directory listing, then io.popen.

Author:  weegee [ Mon Jan 10, 2011 2:29 am ]
Post subject:  Re: Listing directories in Lua

I guess it will switch windows too. Oh and shipping custom executable with a mod, this is pure evil :oops:

Author:  mail2345 [ Mon Jan 10, 2011 3:22 am ]
Post subject:  Re: Listing directories in Lua

Well then, looks like we have to go down to another level of hell and make a custom library.

Author:  weegee [ Mon Jan 10, 2011 3:32 am ]
Post subject:  Re: Listing directories in Lua

Like DLL or something? Then I'll have to port it to MacOS and maybe Linux. I don't need directories THAT much :)

Author:  Mehman [ Mon Jan 10, 2011 9:11 am ]
Post subject:  Re: Listing directories in Lua

Well I know you can read and write files but I don't know about listing directories.

Author:  Patriot24 [ Mon Jan 10, 2011 2:31 pm ]
Post subject:  Re: Listing directories in Lua

mail2345 wrote:
Well then, looks like we have to go down to another level of hell and make a custom library.


Truly shipping a custom executable is far worse than simply compiling an external library. You wouldn't even need to do much, simply make a function that runs dir args and returns the output to lua. It wouldn't switch windows.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/