Skip to content
← Back to Community
How do folders and files work?
Profile icon
ShamirGeorge

I want to create folders that have different .lua files and add to them and run them one at a time, but it keeps just running main.lua.

How do folders and files work? Can I store and multple files in folders that I want to run in a single repl or not?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
TofunmiAshaolu
Profile icon
ShamirGeorge
Comments
hotnewtop
Profile icon
Coder100

Hello, you can configure the run button. Create a .replit file.

Inside, put:

run="lua path/to/file.lua"

And replace with the path of your file. Hopes this helps!

Profile icon
ShamirGeorge

@Coder100 cool, thanks. I made another post with more detials about my question and with the other files I want to execute. I tried this but I couldn't figure it out. It says something about there is no path or something. Anyway, it looks like this will just configure the button to run one file alternatively. I'm looking for a way to put like a bunch of different files to run in a single repl instead of creating a whole new repl for just few lines of code

Profile icon
ShamirGeorge

@Coder100
image

Profile icon
ShamirGeorge

@Coder100 Tried to configure the run button for a single file, even. It's not working, can't figure it out. Let me know if you can figure out the problem from the screen. Thanks

Profile icon
Coder100

hello, sorry if i didn't clarify well. Replace the path to the path of the file.
In this case, it would be

run = "lua hey.lua"

@ShamirGeorge

Profile icon
ShamirGeorge

@Coder100 Alrighty, perfect. Thanks a lot. Now, I can configure the run button. Awesome! Maybe, I'll be able to put eveything into a single repl and configure the run button each time to run different files. It's easy. Thank!

Profile icon
ShamirGeorge

@Coder100 Alright, may I know what I should write for this as well? The file name has spaces in it. Is it possible for me to run it? When I give it a name without spaces, and that name to the .replit file, it works. But not when they're spaces in it. Same goes with folders. I doesn't look like I can add names with spaces in them. Thanks a gain for your responses. Really appreciate it.

image

Profile icon
Coder100

yay! No problem! Glad to help! @ShamirGeorge

Profile icon
Coder100

hello, put it inside quotation marks to be safe:

run = "lua '1 Hello World.lua'"

@ShamirGeorge if that doesn't work, you'll just have to rename the file and replace spaces with underscores :(

Profile icon
ShamirGeorge

@Coder100 Awesome! Thanks!

Profile icon
Bookie0

folders are used to contain files.

you can use different files to store diiferent thing, like a README file, a file to contain all functions/classes, a file for testing, etc.

also to run the files one at the time, i dont think thats possible, as i think that repl.it will run the main file only (i think).

hope this helps! =)

Profile icon
ShamirGeorge

@Bookie0 thanks

Profile icon
Bookie0

sure,

please mark this answer as correct if it helped you =) @ShamirGeorge

Profile icon
[deleted]

I think this will help you: https://stackoverflow.com/questions/2932172/how-to-create-include-files-in-lua-language I don't know how the files work though.

Profile icon
ShamirGeorge

@eekboi Thanks