Archive 17/01/2023.

Variant is passing a null instead of class instance

rogerdv

After solving my previous problem, I found another one when trying to pass a parameter:

class Entity: ScriptObject
{
void Update()
{
if (scr !is null) {				
				Entity@ me = @this;
				Variant param = Variant(me);
				Array<Variant> paramlist;
				paramlist.Push(param);
				if (!scr.Execute("void update(Entity@ e)", paramlist))
          Print("Error executing");
			}
}

}

test.as:
#include "Scripts/RPG/Entity.as"

class testing: ScriptObject
{
	void update(Entity@ e)
	{
		if (e is null)
			Print("Null received");

	}
}

The passed value is null. Is there any error in my Variant conversion?