|
|
|
|
--Get the lua callstack and trim the output to get the executing project.
|
|
--Used in Mission Flow system to get the mission name.
|
|
|
|
function GetProjectName()
|
|
|
|
DrawTextToScreen(, 10, "WHITE")
|
|
|
|
local fullStackStr = System:GetCurrentCallstack();
|
|
|
|
--Lua Regular Expression
|
|
--http://www.lua.org/pil/20.1.html
|
|
--http://www.lua.org/pil/20.2.html
|
|
--http://www.lua.org/pil/20.3.html
|
|
local regexp = "%(domino%\\user%\\[[%w%s%]*%\\]-([%w%s]+)%.[%w%s]+%.lua";
|
|
|
|
|
|
_,_,name = string.find(fullStackStr, regexp);
|
|
|
|
name or System:Warning("Cannot get Project Name from lua call stack");
|
|
|
|
return name;
|
|
end
|
|
|
|
|