Remove __cfx_functionReference


#1

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.


#2

Not possible. Resources are isolated, the only way to pass data is through events and refs.


#3

How to make a clone then?


#4

Not.


#5

even with string.dump and load ?


#6

nope, the bytecode loader is disabled as it’d allow sandbox breaches


#7

How can I do to inject a functions into another ressource? Without using the “require”


#8

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)

#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.