Imagine that you have the following function:
function test(x)
--code
end
There are two ways to export your function
the first is export it automatically inside the script:
exports('test', function(x)
--code
end) -- this will cause the function to be declared and exported automatically
or you can create the function normally, and insert the following line in your fxmanifest.lua
if the function is on the client-side:
client_scripts 'client.lua'
export 'test' -- exports the "test" function from the client-side script above
if the function is on the server-side:
server_script 'server.lua'
server_export 'test' -- exports the "test" function from the server-side script above
Now to use the exported function in other resources it is quite simple, you will need to use the “exports” class and indicate the name of the resource and the function as follows: exports.ResourceName:function(parameters)
let’s imagine that the name of the resource in which the function “test” was exported is called “resourceTest”:
exports.resourceTest:test(3) -- will call the test function of the resource resourceTest and with parameter 3
Now you can use the “test” function on any resource and any script 
for your curiosity, Lua offers a “dofile” function that executes another script next to the current script, but it is not recommended to be used in FiveM
dofile("./script.lua")