Get containing path of lua file
snippet in lua

Get containing path of lua file

user6586

function script_path()
   local str = debug.getinfo(2, "S").source:sub(2)
   return str:match("(.*/)")
end

print(script_path())