Skip to content

1.4.0

Compare
Choose a tag to compare
@TommyB123 TommyB123 released this 14 Nov 03:21
· 9 commits to master since this release

Adds JSON_ArrayIterate to easily iterate through a JSON array.
Adds JSON_CountNodes to count how many active JSON nodes currently exist in memory.

JSON_ArrayIterate example:

new Node:node, Node:textures;
JSON_Parse(string, node);
JSON_GetArray(node, "textures", textures);

new Node:texture, i, index, modelid, txd[128], txt[128], color;
while(!JSON_ArrayIterate(textures, i, texture))
{
	JSON_GetInt(texture, "index", index);
	JSON_GetInt(texture, "modelid", modelid);
	JSON_GetString(texture, "txd", txd);
	JSON_GetString(texture, "texture", txt);
	JSON_GetInt(texture, "color", color);
	SetDynamicObjectMaterial(objectid, index, modelid, txd, txt, color);
}

The function will automatically increment the current index and also garbage collect any previously used JSON node during iteration.

native JSON_ArrayIterate(Node:node, &index, &Node:output);
native JSON_CountNodes();