Hello,
I don't understand why it's happening but Cloudscript behaves different than any other Online JS editor.
- In game code:
This is the code to execute cloudscript:
int type = 0; long totalTake = 408; string chance = "93.35"; ExecuteCloudScriptRequest request = new ExecuteCloudScriptRequest() { FunctionName = "TestFunc", FunctionParameter = new { Type = type, TotalTake = totalTake, Chance = chance }, GeneratePlayStreamEvent = true };
This is the Cloudscript code:
handlers.TestFunc = function(args, context) { if(args == null || args.Type == null || args.TotalTake == null || args.Chance == null) return 0; if(args.Type == "" || isNaN(args.Type) || args.TotalTake == "" || isNaN(args.TotalTake) || parseInt(args.TotalTake) <= 0 || args.Chance == "" || isNaN(args.Chance) || parseFloat(args.Chance) < 0) return 1; return 2; };
The problem is the Cloudscript returns 1 instead of 2. I don't understand.
- Online JS code:
I wrote a similar code in an online JS editor and the result is 2.
I'm sure, I'm doing something wrong but what is the issue here?