Hello everybody!
I’m a newbie in Corona/Solar2D.
And I faced with problem - how inport .lua files in my project?
I am a programmer with practice and am used to breaking code into small pieces.
I saw that in Lua it is possible to import files, but an error appears in Corona.
Hello!
To import a file, you need to add it to the project folder and connect via require.
Examples:
added the server.lua file to the project folder (next to the main.lua file). Now, to access it from the Main.lua file, I write
local server = require (“server”)
added the file to the src folder (src / server.lua). Connect like this:
local server = require (“src.server”)