问题描述
我想知道是否有一种方法来获取当前正在执行的lua脚本文件的路径?
这不是当前的工作目录,可能完全不同。我知道将让我得到当前的工作目录,但似乎并不能够告诉当前正在执行的脚本文件。
谢谢
编辑:
我是没有从标准的命令行解释器运行,我正在通过 luabind
如果标准命令行解释器正在运行Lua脚本,请尝试 arg [0]
。
I am wondering if there is a way of getting the path to the currently executing lua script file?
This is specifically not the current working directory, which could be entirely different. I know luafilesystem will let me get the current working directory, but it doesn't seem to be able to tell the current executing script file.
Thanks
EDIT:I'm not running from the standard command line interpreter, I am executing the scripts from a C++ binary via luabind.
If the Lua script is being run by the standard command line interpreter, then try arg[0]
.
这篇关于获取包含lua文件的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!