diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/lua_function.cpp | 16 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_luafloater_demo.lua | 2 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_luafloater_gesture_list.lua | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/indra/llcommon/lua_function.cpp b/indra/llcommon/lua_function.cpp index 96282df554..cd83f40e85 100644 --- a/indra/llcommon/lua_function.cpp +++ b/indra/llcommon/lua_function.cpp @@ -711,7 +711,7 @@ std::pair<LuaFunction::Registry&, LuaFunction::Lookup&> LuaFunction::getState() lua_function(source_path, "return the source path of the running Lua script") { luaL_checkstack(L, 1, nullptr); - lua_pushstdstring(L, lluau::source_path(L)); + lua_pushstdstring(L, lluau::source_path(L).u8string()); return 1; } @@ -721,7 +721,19 @@ lua_function(source_path, "return the source path of the running Lua script") lua_function(source_dir, "return the source directory of the running Lua script") { luaL_checkstack(L, 1, nullptr); - lua_pushstdstring(L, lluau::source_path(L).parent_path()); + lua_pushstdstring(L, lluau::source_path(L).parent_path().u8string()); + return 1; +} + +/***************************************************************************** +* abspath() +*****************************************************************************/ +lua_function(abspath, + "for given filesystem path relative to running script, return absolute path") +{ + auto path{ lua_tostdstring(L, 1) }; + lua_pop(L, 1); + lua_pushstdstring(L, (lluau::source_path(L).parent_path() / path).u8string()); return 1; } diff --git a/indra/newview/scripts/lua/test_luafloater_demo.lua b/indra/newview/scripts/lua/test_luafloater_demo.lua index c2d16d4f88..ab638dcdd1 100644 --- a/indra/newview/scripts/lua/test_luafloater_demo.lua +++ b/indra/newview/scripts/lua/test_luafloater_demo.lua @@ -1,4 +1,4 @@ -XML_FILE_PATH = LL.source_dir() .. "/luafloater_demo.xml" +XML_FILE_PATH = LL.abspath("luafloater_demo.xml") scriptparts = string.split(LL.source_path(), '/') scriptname = scriptparts[#scriptparts] diff --git a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua index a907eb2e90..3d9a9b0ad4 100644 --- a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua +++ b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua @@ -1,4 +1,4 @@ -XML_FILE_PATH = LL.source_dir() .. "/luafloater_gesture_list.xml" +XML_FILE_PATH = LL.abspath("luafloater_gesture_list.xml") scriptparts = string.split(LL.source_path(), '/') scriptname = scriptparts[#scriptparts] |