• Reloading Scripts?
    6 replies, posted
I edited one line of code in a lua file for an addon garrysmod\addons\*addon name*\lua\autorun\filename.lua I'm trying to edit an addon, (in addons it has a space, is that a problem?) And I don't want to have to restart gmod because of one line, is there a command to reload the script or an addon that allows you to edit lua from you're addons folder?
concommand.Add("reload_script" , function() include(debug.getinfo(2).short_src) end )
Okay.....I'll test and see if that works.. edit: Couldn't include file 'lua\includes\modules\concommand.lua' (File not found) I'm editing the Sickness Models vehicle car pack thing and adding extra seats to the cars, because only two of them have more than 1 seat..
Oh well, thought that would work. Try this instead. concommand.Add("reload_script" , function() include("path/to/script.lua") end ) You don't need to go back to addons, just do it directly relative to the Lua folder.
F, I got dinner. I'll go eat and test it, and I'll edit this post if it works or not. edit: concommand.Add("reload_script" , function() include("lua/autorun/Sickness.lua") end ) and got: Couldn't include file 'lua\autorun\Sickness.lua' (File not found) I need to test one more thing before I can say it won't work. Should it be "SicknesModels/lua/autorun/file.lua" or just lua/autorun ?
autorun/file.lua Don't need to put in lua/ as it automatically starts in lua.
K thanks a ton. edit: I did that, I type it in after changing my coding I get no errors, but nothing happens. another edit: I'm no luaer so I don't know where to put this line of coding, I just put it in the file I mainly want to "reload" . EDIT: Sorry, I'm a major moron. Didn't even think to respawn the car..
Sorry, you need to Log In to post a reply to this thread.