Get containing path of lua file

后端 未结 10 1929
粉色の甜心
粉色の甜心 2021-02-12 12:00

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

10条回答
  •  孤独总比滥情好
    2021-02-12 12:14

    if you want the actual path :

    path.dirname(path.abspath(debug.getinfo(1).short_src))
    

    else use this for full file path :

    path.abspath(debug.getinfo(1).short_src)
    

提交回复
热议问题