Help with including files

init.lua


AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
AddCSLuaFile("settings.lua")
include("shared.lua")
include("settings.lua")

cl_init.lua


include("shared.lua")

I’m attempting to include the file “settings.lua”. (this file is for easy customization/changes)

The console prints:


[AddCSLuaFile] Couldn't find 'settings.lua' <@addons/darkrpmodification-master/lua/entities/printer/init.lua <line 6>>

It says the same thing but with “couldn’t include” in place of “couldn’t find”.

Am I missing how to include files properly? Been having issues with this for a while. Any insight would be appreciated!

–Anarchy

init.lua



AddCSLuaFile("cl_init.lua")
include("shared.lua")
include("settings.lua")


cl_init.lua



include("shared.lua")
include("settings.lua")


Try this

No he did it right the first time, it’s something else. Could you please show use your entire file structure? Also do you plan on using “settings.lua” on the client side?

-snip-

Do you not get that its because the file isn’t found in the directory? His code is fine. The file just isn’t where gmod is trying to find it

-snip- dumb post

His code is indeed fine, this way works. But it’s not recommended to add lua files to the client unless you’re using them.

[editline]15th June 2014[/editline]

Server

init.lua


AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
include("settings.lua")

cl_init.lua



include("shared.lua")

Shared

init.lua


AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
AddCSLuaFile("settings.lua")
include("shared.lua")
include("settings.lua")

cl_init.lua



include("shared.lua")
include("settings.lua")

That’s the exact same as I posted before, yet you disagreed with it? ZombieWizzard is right anyways, the file probably doesn’t even exist there.

ZombieWizzard is correct. It is almost the same, but it’s 100% correct.

there’s no code in settings.lua

Thank you all for the replies. I have not put any code on settings.lua. The settings.lua file is in the same directory as the init, cl_init and shared.

you need to put something in settings.lua

Okay I’ll try tomorrow

Empty files will have that effect, simply add // to the top line and it’ll fix it.