How to include a lua file that is in an upper folder?
3 replies, posted
I'm trying to make a few lua files that are in addons/hsadmin/lua/autorun include a configuration file in addons/hsadmin/lua.
However, i get this error:
[CODE][Sneaky-INACTIVETIL27JUNE|2|STEAM_0:0:70663366] Lua Error:
Couldn't include file '..\configuration.lua' (File not found) (@addons/hsadmin/lua/autorun/sv_system_report.lua (line 1))
[Sneaky-INACTIVETIL27JUNE|2|STEAM_0:0:70663366] Lua Error:
Couldn't include file '..\lang.lua' (File not found) (@addons/hsadmin/lua/autorun/sv_system_report.lua (line 2))[/CODE]
I use include("../configuration.lua") which doesn't work.
How can i make this work?
include( "configuration.lua" )
The wiki is your friend my dude
To expand on JasonMan's post... [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/include]include[/url]
[I]Executes a Lua script either relative to the current file, or absolute(relative to the /lua/ folder).[/I]
And yes, making a thread should be your last resort after not being able to find your answer elsewhere online, especially when it's the first line on the wiki for the function you are using.
what are you are essentialy doing with .. is asking it to read up a directory, which is pointless since your lua files are located in the same dir so that is unnecessary and trying to find a file that doesn't exist
Sorry, you need to Log In to post a reply to this thread.