Closed Tetragromaton closed 4 years ago
Hey there! I don't think this is specifically a problem with the library, but rather just how SourcePawn works. The following snippet, which only uses types native to SourceMod, produces the same error as yours.
StringMap sm = new StringMap();
public void OnPluginStart()
{
sm.Clear();
}
The best way to get around this (and how I get around it with plugins that have global JSON instances) is by declaring the variable as null in the global scope and then properly initialising the instance in your OnPluginStart, for example:
#include <json>
JSON_Array argr = null;
public void OnPluginStart()
{
argr = new JSON_Array();
argr.PushObject(null);
}
Hope this helps.
Description
A clear and concise description of what the bug is. Error on compilation. In case if you try to define JSON_Array as global in plugin, you will get error if you pushObject inside of it.
Reproduction
Versions
sm-json: v3.0 SourceMod Compiler: SPEDIT SourceMod Build: ver 1.8