How to import a lua module
-
Hi, i'm starting to help on a esx FiveM server and my idea was to create a file lua with some basic methods to import/require in all my client/file.lua, but i don't get how to do this. I've tride something like that:
in the 'server-data' folder i've placed a file base.lua:local base = {}
function base.sum(num1,num2)
return num1+num2
endreturn base
and in a client/main.lua:
local base = require("base.lua")
base.sum(1,2)but nothing works.
What's the right way to do this? Thank's
-
ESX and FiveM are dogshit, but that aside: try asking this on the FiveM forums, you might get more answers that way.