"include" help

how can i use include that way?, because i got a file in “gamemode/derma/file.lua” and i have to include a file that is in “gamemode/”, sorry im a bad explainer but if you know what i mean can you please tell me


http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.include)** ? Take look at that

i still dont get it

If you have a file at “gamemode/derma/”, chances are you included that file in cl_init.lua. So go ahead and add the include line for the second file there too.


– cl_init.lua

– derma/file.lua
–Yay, I can use stuff declared in cl_file.lua in here too!

Hope this helps

im trying to go back one directory :confused:

I’d say use … to go back one directory, e.g:
You’re in gamemode/derma:
…/init.lua would be init.lua in gamemode.

Though I’m not sure if … still works(last time I tried I failed)… I’ve been told that include can also be relative to the Lua directory.

In short…

include() just runs the lua file, nothing else.

God, will you guys learn to read?

include is either relative to the file it’s being called from or the lua/gamemode directory.

thank you :), i will try that.

did not work…

You cannot include a file that isnt in a subdirectory.

So if I have init.lua in /gamemode/lol/ I cannot include a file from /gamemode/ same thing with /lua/lol/ and /lua/