Lua exports only allowing a single return value

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.

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?"

local test1, test2, test3 = exports["MyResource"]:ThisIsAnExportFunction()

test1, test2, test3 = ThisIsAnExportFunction()

Add ThisIsAnExportFunction as an export to the fxmanifest and start the resource. the output will be as following:


am I
doing wrong here?

Store multiple variables in a table and return that instead.

yea should be better

I guess that is probably the only way then.
I mean for Lua it would probably work, but the export system would need to be changed and that probably wouldn’t work for C# or js.

Should be same process in C# and JS. Store variables to object / class and export that.

or if you would like to create a JSON String and work with that. should be easier to parse in c# and js

I guess, I’ll just open up a feature request. Maybe it is something they can take into consideration in a future update :smiley:

Edit: More than one return value for Lua exports