Hi. I'm trying to reload some of my scripts in my addons folder without changing the map or restarting the game.
Script path: garrysmod\addons\testfolder\lua\myScript\script.lua
Didn't work:
[CODE]] lua_openscript_cl "testfolder\lua\myScript\script.lua"
] lua_openscript_cl testfolder\lua\myScript\script.lua
] lua_openscript testfolder\lua\myScript\script.lua
] lua_openscript testfolder/lua/myScript/script.lua
] lua_openscript_cl testfolder/lua/myScript/script.lua
] lua_openscript_cl "testfolder/lua/myScript/script.lua"
] lua_openscript_cl "myScript/script.lua"
] lua_openscript_cl myScript/script.lua
] lua_openscript myScript/script.lua
] lua_openscript "myScript/script.lua"
] lua_openscript "myScript\script.lua"
] lua_openscript myScript\script.lua
] lua_openscript_cl myScript\script.lua
] lua_openscript_cl "myScript\script.lua"[/CODE]
I always get this error: Couldn't include file '...' (File not found) (<nowhere>)
Those files are relative to the lua folder right?
] lua_openscript_cl myScript/script.lua
] lua_openscript myScript/script.lua
Should work. Try removing the capitals from the folder name.
If you're trying to open a lua script server-side, use lua_openscript, if you're trying to open a lua script client-side, use lua_openscript_cl.
And the path is always relative to the lua folder.
Gmod 13:
[code]RunString( file.Read( "addons\testfolder\lua\myScript\script.lua", "GAME" ))[/code]
Gmod 12:
[code]RunString( file.Read( "addons\testfolder\lua\myScript\script.lua", true ))[/code]
Run that lua, and it should work...
Also, you're not 'reloading' the script rather you're running the script multiple times. So keep that in mind.
[b]Edit:[/b]
This might not have the desired result but adapt the method to your code.
Sorry, you need to Log In to post a reply to this thread.