HayManMarc
Member
Does this make sense to you? It's really making me confused.
Copy/pasted from the manual:
-----------------------------------------------------------
Syntax:
Returns:
string
Example:
The above code will convert the "_contents" struct into a JSON string and store the string in a variable. The actual string would be like this:
{ "version": "1", "myObj": { "header": "You are receiving a packet", "webSocket": 1, "body": "A packet of cheese and onion crisps", "ipv4Address": "95.39.220.218", "ipv6Address": "0000:0000:0000:0000:0000:ffff:5f27:dcda" } }
------------------------------------------------------
Up there, at the end of the example code, is "packet = json_stringify(map);" Where is "map"? What is that referencing? Shouldn't it be "_contents" instead of "map" for this example?
Also, I'm trying to make sense of that last bit, after it says "The actual string would be like this:" Where does "myObj" come from? And "A packet of cheese and onion crisps"?
All of this just doesn't line up correctly to me. Or I'm just really dense and can't follow it? I'm trying to learn this to implement a save system, and I keep running into these types of confusing things in the manual. Makes learning this stuff a lot harder.
Copy/pasted from the manual:
-----------------------------------------------------------
Syntax:
Code:
json_stringify(val)
Argument | Description |
---|---|
val | The reference value for a struct or array to convert into a JSON string |
Returns:
string
Example:
Code:
var _contents = {
version : "1",
data: {
webSocket : 1,
ipv4Address : "95.39.220.218",
ipv6Address : "0000:0000:0000:0000:0000:ffff:5f27:dcda",
header : "You are receiving a packet",
body : "This packet is empty and only for testing",
},
};
packet = json_stringify(map);
{ "version": "1", "myObj": { "header": "You are receiving a packet", "webSocket": 1, "body": "A packet of cheese and onion crisps", "ipv4Address": "95.39.220.218", "ipv6Address": "0000:0000:0000:0000:0000:ffff:5f27:dcda" } }
------------------------------------------------------
Up there, at the end of the example code, is "packet = json_stringify(map);" Where is "map"? What is that referencing? Shouldn't it be "_contents" instead of "map" for this example?
Also, I'm trying to make sense of that last bit, after it says "The actual string would be like this:" Where does "myObj" come from? And "A packet of cheese and onion crisps"?
All of this just doesn't line up correctly to me. Or I'm just really dense and can't follow it? I'm trying to learn this to implement a save system, and I keep running into these types of confusing things in the manual. Makes learning this stuff a lot harder.