Is it possible to create a directory in lua ? If so, how ?
+4
A:
I'm pretty sure it is; look in the "os" part of the library!
Failing that, there's a "system" call (or something like that, this is from memory) which you should be able to use to run an arbitrary program, which could include the mkdir command.
EDIT: I found my Programming in Lua book. On page 203, it mentions how you could use an
os.execute("mkdir " .. dirname)
to "fake" a directory creation command.
Carl Smotricz
2009-11-06 22:29:31
The Lua design philosophy is to be pure ISO C, so as to be portable to anything with a C compiler. There is no directory creation function in the C standard library. This is left up to platform-specific extensions, like mkdir(2) on POSIX systems and CreateDirectory*() on Windows.
Warren Young
2009-11-06 22:42:42
Thanks ;) ! I knew I could do that kind of execute(), but I was wondering if there was a Lua alternative... I guess there isn't ;) !
Wookai
2009-11-06 22:43:25
+7
A:
You may find the LuaFileSystem library useful. It has a mkdir function.
Arthur Reutenauer
2009-11-06 22:56:55
Thanks for the link ! I can't user other libraires for the moment, so I'll stick with the os.execute() version, but I'll keep LuaFileSystem in mind for next time !
Wookai
2009-11-09 20:43:37