Hello, I am trying to require a lua module, Json.lua, but it is trying to find it in includes\modules\ instead of the addons autorun folder. I tried using ./ but it did nothing. Any idea on how I can do this so I can make setup easier (as I am making a public addon)?
Couldn't include file 'includes\modules\json.lua' (File not found) (@addons/saddys_multicore_rendering/lua/autorun/sh.lua (line 1))
[ERROR] addons/saddys_multicore_rendering/lua/autorun/sh.lua:1: Module not found!
1. require - [C]:-1
2. unknown - addons/saddys_multicore_rendering/lua/autorun/sh.lua:1
Couldn't include file 'includes\modules\.\json.lua' (File not found) (@addons/saddys_multicore_rendering/lua/autorun/sh.lua (line 1))
[ERROR] addons/saddys_multicore_rendering/lua/autorun/sh.lua:1: Module not found!
1. require - [C]:-1
2. unknown - addons/saddys_multicore_rendering/lua/autorun/sh.lua:1
json = require "json"
Don't bind a require statement to a variable, you don't need to.
Here are the paths you can use to find files.
File Search Paths
The require function works slightly different in GMod so it won't return anything you return in the file being required. If you want to do that you should use include. The GMod require checks for modules in '/lua/bin/' and '/lua/includes/modules/', if neither directory has the specified file then it will print the error you're getting.
And why are you trying to require a JSON module? GMod already has all the JSON functions you could need.
Sorry, you need to Log In to post a reply to this thread.