• How does include() decide where to include from?
    2 replies, posted
[URL=http://wiki.garrysmod.com/page/Global/include]According to the wiki[/URL], include "executes a Lua script either relative to the current file, or absolute(relative to the /lua/ folder)". How does it decide which path to execute the script from? Here's an example; [CODE]addon_name |-lua |-autorun | |-hello.lua |-world.lua[/CODE] I can use both include('world.lua') and include('../world.lua'), so which is better? I assume I should also keep the same style throughout the project? (always use either relative to the lua folder or to the current file).
I personally use the former rather than the latter. I guess it's a matter of opinion as they both work fine.
Pretty sure it searches both directories.
Sorry, you need to Log In to post a reply to this thread.