Hello,
I would like to make sure that this code works:
Ressource A:
Lib = {}
Name = "toto"
function AddFunction(name, callback)
Lib [name] = callback
end
Resource B:
exports.lib:AddFunction('Get', function()
print(Name)
end)
I would like to do that the function of the resource B is in the resource A. So I would like Name to be displayed.
osmium
2
Not possible. Resources are isolated, the only way to pass data is through events and refs.
How to make a clone then?
even with string.dump and load ?
nope, the bytecode loader is disabled as it’d allow sandbox breaches
How can I do to inject a functions into another ressource? Without using the “require”
I have this error, it has a link with the Reference?
Exemple code : https://repl.it/Kcnr/26
exports.ft_players:AddPlayerMethod('GetCash', function(self)
return self.cash + 0.0
end)
Syntasu
9
You can include other resources in the __resource.lua. For example
server_script "@mysql-async/lib/MySQL.lua"
This will include the “MySQL.lua” of mysql-async into your resource. Take a look at mysql-async resource on how exactly it is done.