Hey everyone, hope you are having a lovely day!
So, I have been working with this module called SLVM (Which stands for Secure Lua Virtual Machine). For the most part, I have gotten it to work, but I can’t get this to work (plus I don’t reaaaally know what it means).
The problem is that when I use this, I get “attempt to index nil with ‘func’”.
Here is what the code inside the module is:
local module = {}
function module.func(param)
print(param)
end
return module
And here is a snippet of the “main” script (LocalScript)
local allowedModule = game.ReplicatedStorage.Services.ModuleScript
local requiredAllowedModule = require(allowedModule)
LuaVM:ReplaceClosure(require, function(module)
assert(module == allowedModule, "module cannot be required")
return requiredAllowedModule
end)
LuaVM:AddReadHook(requiredAllowedModule, function(self, Index, NormalValue)
if type(Index) == "string" then
if "func" == Index then
return NormalValue
end
end
error("cannot use function '" .. Index .. "' from module", 2)
end)
Any help is appreciated, and if you need any more clarification on anything at all, I will be happy to give some as I don’t believe I provided a lot to work with (sorry!).
Thank you all
~Robyn