Hi! I have a very simple question.
How can I use require in Gideros for a Lua file in my project?
I tried with: (assuming elements.lua is next to main.lua)
local elements = require("elements")
local elements = require("elements.lua")
I also had two different files and tried:
Using a relative path
Using dots as separators
Using the full path from assets
But nothing worked.
Can someone please give me an example? Sorry for the basic question, but this error is driving me crazy, and I don't want to solve it using global variables.
[string "luabinding/compatibility.lua"]:82: Module elements.lua not found
stack traceback:
[string "luabinding/compatibility.lua"]:82: in function require
main.lua:3:
Please Help
Comments
Assuming I have a file called level01.lua in a "tiled" folder:
You may also need to add exclude from execution at the top of your "elements.lua" file?
--!NOEXEC
-https://wiki.gideros.rocks/index.php/Require
Hope this helps?
Likes: zeroexu
It worked.
I needed to use
--!NOEXEC
in the file to be imported,
and in the file that uses require:
--!NEEDS:your_file.lua
And that's it!
Thank you so much!
Likes: MoKaLux