• Referring to scripts
    3 replies, posted
This is most likely a very nooby question and indeed... I am a noob to programming in lua and creating GMod addons. The thing I want to do is get access to a global variable within another script, that being sv_rounds.lua within the murder gamemode but no matter how much I try, I can't figure out a way to refer to the script. I tried using require() but it never is able to find the script. Could anyone help me?
if it's a global variable then you won't need to use include(), and require() is for modules(?). Which variable from sv_rounds.lua are you trying to access?
[QUOTE=Arizard;50115471]if it's a global variable then you won't need to use include(), and require() is for modules(?). Which variable from sv_rounds.lua are you trying to access?[/QUOTE] I'm trying to use the roundTime variable within the sv_rounds script.
[QUOTE=codelyoko373;50117258]I'm trying to use the roundTime variable within the sv_rounds script.[/QUOTE] Idk if this is the best way to do this but it's a GM variable so you could do: [lua]gmod.GetGamemode().RoundTime[/lua]
Sorry, you need to Log In to post a reply to this thread.