I am new to lua and have been looking at documentation and other gamemodes. What I don’t get is if I want to do something totally from scratch, and I make a new file which does this, do I need to some how reference it in init.lua or will those files just be ran simultaneously? This may not even make since but it is confusing me. Thanks for answering.
What are you referring to? SENTs, SWEPs, gamemodes? You seem to be referring to gamemodes. So only init.lua, cl_init.lua and shared.lua will run automatically. If you want to run a file just do include(filename). The filepath is relative to the directory of the file you’re running. If in your gamemode directory you have:
and you do include(“anotherfile.lua”) it’ll run that file, but only on the server because init.lua, the file that called include, was only running on the server.
Ok cool I think I understand. So if I wanted a file that tallied up points for destroying certain items, I could name it point_count.lua, and do include(“point_count.lua”) in init.lua and it would work fine? Also could I just put the same code directly in init.lua and it would still work? So basically making seperate files is for organization?
All of that is correct.