Small function that i created for the funny its not really useful though. Yes it can prevent really dumb skids from accessing your module that dont know how to use unc functions but otherwise theres no other way to protect your module other than encrypting it or obfuscating.
--!strict
local module = {}
function module.someFunction()
return "Hello from module"
end
local createProxiedModule = function(originalModule: {any})
return setmetatable({}, {
__index = function(self, key)
local caller, line, name = debug.info(2, "sln")
if caller == "" or caller == nil then
return nil
elseif string.find(caller, "Loadstring") then
warn("XENO DETECTED LAMAOOAOAOAOAO")
return nil
end
return originalModule[key]
end;
__newindex = function(self, key, value)
local caller, line, name = debug.info(2, "sln")
if caller == "" or caller == nil then
return nil
elseif string.find(caller, "Loadstring") then
warn("XENO DETECTED LAMAOOAOAOAOAO")
return nil
end
originalModule[key] = value
return originalModule[key]
end;
__tostring = function()
return ""
end;
__metatable = false;
})
end
return (createProxiedModule(module) :: any) :: typeof(module)