mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-04 09:42:30 +02:00
Introduce unique prefix for Redmew GUI elements (#1297)
Due to collisions with mods when naming GUI elements with just numbers, I added a prefix when naming elements with ``utils.token.uid()``.
This commit is contained in:
parent
39a0d0fb54
commit
e5f3cc7a69
@ -6,6 +6,8 @@ local Styles = require 'resources.styles'
|
||||
local tostring = tostring
|
||||
local next = next
|
||||
|
||||
local gui_element_prefix = "Redmew_"
|
||||
|
||||
local Gui = {}
|
||||
|
||||
local data = {}
|
||||
@ -27,7 +29,7 @@ local on_pre_hidden_handlers = {}
|
||||
Gui._top_elements = top_elements
|
||||
|
||||
function Gui.uid_name()
|
||||
return tostring(Token.uid())
|
||||
return gui_element_prefix .. tostring(Token.uid())
|
||||
end
|
||||
|
||||
-- Associates data with the LuaGuiElement. If data is nil then removes the data
|
||||
@ -322,7 +324,7 @@ if _DEBUG then
|
||||
local filepath = info.source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
|
||||
local line = info.currentline
|
||||
|
||||
local token = tostring(Token.uid())
|
||||
local token = gui_element_prefix .. tostring(Token.uid())
|
||||
|
||||
local name = concat {token, ' - ', filepath, ':line:', line}
|
||||
names[token] = name
|
||||
|
Loading…
Reference in New Issue
Block a user