forked from m00nyONE/LibCustomNames
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnil.lua
More file actions
27 lines (23 loc) · 914 Bytes
/
nil.lua
File metadata and controls
27 lines (23 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- SPDX-FileCopyrightText: 2025 m00nyONE
-- SPDX-License-Identifier: Artistic-2.0
local lib_name = "LibCustomNames"
local lib = _G[lib_name]
--- Returns a read-only proxy table
local function readOnly(t)
local proxy = {}
local metatable = {
--__metatable = "no indexing allowed",
__index = t,
__newindex = function(_, k, v)
if TBUG or Zgoo then return end -- don't show message edits when Torchbug or Zgoo are running
d("attempt to update read-only table")
--error("<-- This malicious Addon tried to overwrite protected data! Screenshot the Error and report the Addon! Remove it Immediately afterwards!", 2)
end,
}
setmetatable(proxy, metatable)
return proxy
end
-- remove GetNamesTable function so others addons can not alter the data anymore
lib.GetNamesTable = nil
-- make the Lib read-only
_G[lib_name] = readOnly(lib)