Is there a way to get current path of the executing Lua script in OpenResty?E.g.content_by_lua_file 'test.lua';And in test.lua:local currentPath = -- something here?Because otherwise everything seem to be relative to nginx binary path. .
Hello,I use debug.getinfo(1). The returned table will have a 'source' key. I see the following idiom used quite a bit local current_path = string.sub(debug.getinfo(1).source, 2, string.len("/scriptname.lua") * -1)
On Monday, 18 January 2016 20:12:45 UTC+2, Lord Nynex wrote:Hello,I use debug.getinfo(1). The returned table will have a 'source' key. I see the following idiom used quite a bit local current_path = string.sub(debug.getinfo(1).source, 2, string.len("/scriptname.lua") * -1)Is there any other ways than using debug-library? I'm not sure I want to add dependency to debug library in any of my libs. But thanks anyway, this is one possibility. .