Reputation: 21
I want to know current working directory and then go back to parent directory of current directory using a Lua script.
For example:
Current directory: C:\programs\lua_script
Desired Output: c:/programs/
Upvotes: 1
Views: 1304
Reputation: 7046
Lua doesn't know or care what a directory is, and it can't change its current directory either.
You would need to use a platform-specific library for that, like luaposix on POSIX systems. As a workaround, you can query the current working directory by calling another program with io.popen()
and parsing the output, but this won't allow you to change directory.
Upvotes: 1