I have recently released a standalone callback resource using exports: [RELEASE] Callbacks using exports and with added timeouts! [FREE]
With this resource it is possible to trigger and register server and client callbacks. You would directly get all the return values back from the export instead of using callback functions etc.
e.g.:
local data1, data2, data3 = exports["kimi_callbacks"]:Trigger("doSomething", someOtherData)
I swear I have tested this a thousand times before I released it and it worked fine. But after updating another one of my resources with the standalone exports version of this callback script, it suddenly only returns the first value. (in the example above data2 and data3 would always be nil)
The callback still works 100%, it is just the event return values, that didn’t work as I expected.
But now I feel stupid. I spent an hour looking into the FiveM repository to try and figure out if something changed internally etc.
Now to my question: Is it even possible to get more than one return value from exports and I just dreamed it worked?
My guess would be that it has something to do with C# / js not being able to have the same feature?
Code snippet for repro
function ThisIsAnExportFunction()
return "what", "am I", "doing wrong here?"
end
local test1, test2, test3 = exports["MyResource"]:ThisIsAnExportFunction()
print(tostring(test1))
print(tostring(test2))
print(tostring(test3))
test1, test2, test3 = ThisIsAnExportFunction()
print(tostring(test1))
print(tostring(test2))
print(tostring(test3))
Add ThisIsAnExportFunction
as an export to the fxmanifest and start the resource. the output will be as following:
what
nil
nil
what
am I
doing wrong here?