Getting a variable from js in lua

Hey guys,

So i’ve been looking for a way to get a variable that i return using a js function in lua, then i can use it to do an insert in my database, but i didn’t find anything helpful, i’m new to the fivem dev, so if anyone can help me please.

Use exports https://docs.fivem.net/docs/scripting-reference/runtimes/javascript/functions/exports/

Hey, Thanks for taking time to read and reply to this.

yes that’s what i did but it’s not working and i don’t know what i’m doing wrong,

this is my js file

exports('myFunc', (param1) => {
    var result = 'param1';
    return result;
});

also in my lua file i did this

local myvariable = exports.myresourceName.myFunc('Hey')

and last my __resource file

files({
  'myFile.js'
})
exports {
  'myFunc'
}