Add a central function to create an identifier from string, and also expose it through Lua

This commit is contained in:
Emma Broman
2023-04-03 11:40:19 +02:00
parent 0e2d5e245d
commit 4de3713107
9 changed files with 61 additions and 56 deletions
+3 -4
View File
@@ -32,10 +32,9 @@ end
local ReloadUIScript = [[ if openspace.hasProperty('Modules.CefWebGui.Reload') then openspace.setPropertyValue('Modules.CefWebGui.Reload', nil) end ]]
if is_image_file(extension) then
identifier = basename_without_extension:gsub(" ", "_")
identifier = identifier:gsub("%p", "_") -- replace all punctuation characters with '_'
return [[openspace.addScreenSpaceRenderable({
Identifier = "]] .. identifier .. [[",
return [[
openspace.addScreenSpaceRenderable({
Identifier = openspace.makeIdentifier("]] .. basename_without_extension .. [["),
Type = "ScreenSpaceImageLocal",
TexturePath = "]] .. filename .. [["
});]] .. ReloadUIScript