G.SetGlobalVar
From GMod Wiki
Function | |
Syntax |
SetGlobalVar( Var index, Var value ) Where is this used? |
Description: | |
Similiar to the function Entity:SetNetworkedVar - Sets a networked global var of the types String , Integer , Float , Angle , Boolean , Entity or Vector . | |
Returns: | nil |
Part of Library: | Global Functions |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=G.SetGlobalVar]G.SetGlobalVar [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Set a global variable which can be accessed both clientside as serverside |
---|---|
Used on | |
Code | SetGlobalVar("Timeleft",10) |
Output | None |
Description | Get that global variable which we've just set |
---|---|
Used on | |
Code | print("Time left: "..GetGlobalVar("Timeleft")) |
Output | Time left: 10 |
Additional Notes
- It is recommended that you do not use SetGlobalVar, it is not type safe and could lead to issues.