It looks like you're new here. If you want to get involved, click one of these buttons!
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.
local file = io.open( "|D|mydir/myfile.txt", "w" )
file:write( "something" )
io.close( file )