how to declare a global variable? can't I declare =(
P.S: js
in JS is not working global (for example: global.BasePlayer.activePlayerList.Count)
Declaring global variables with JavaScript?
Discussion in 'Rust Development' started by Мизантроп, Jan 23, 2015.
-
Wulf Community Admin
I'm not sure, I'll see if I can get an answer for you though.
-
Can you give an example of what you're trying to do?
-
Replicating the error:
Code:cmdTest : function(){ global.ConsoleSystem.Broadcast("chat.add \"" +"ERROR"+ "\" \"" +"global does not work x)"+ "\""); },
-
-
when my pull request is merged following will work:
Code:var jstest = { Title : "Javascript Test", Author : "Nogrod", Version : V(1, 0, 0), HasConfig : true, OnServerInitialized : function () { var global = importNamespace(""); print(global.BasePlayer.activePlayerList.Count); webrequests.EnqueueGetHook("http://loripsum.net/generate.php?p=1&l=short", "RequestResult", this.Plugin); }, RequestResult : function (code, response) { print(code+"|----|"+response); } }
-
Code:var test = { Title : "Javascript Test", Author : "Nogrod", Version : V(1, 0, 0), HasConfig : true, Init : function () { var global = importNamespace(""); print(global.BasePlayer.activePlayerList.Count); } }
-
Wulf Community Admin
-