jua
jua copied to clipboard
Sandboxing each script?
Doing the following works, but I was wondering if there was a way to do it from my Java code;
java.require = function(str)
print("Access to java package" .. str .. "has been denied.");
end
I am using this utility to create an event system. Each Java ’Event’ has a corresponding script file. Each file is organized like this;
event = {
eval = function(scope, gamestate, ui)
if(self:allow(scope, gamestate))
self:effect(scope, gamestate, ui);
end
end,
allow = function(scope, gamestate)
return false;
end,
effect = function(scope, gamestate, ui)
print('effect');
end
}
I loop through the events and call event.eval for each. Is there an easy way to sandbox them? I cannot really expose the lua method of doing this to the public on my release because it would be easy foranybody to unsandbox it and start screwing with the system. Thanks in advance.