This page shows example code work converting from typename to string and back again.
https://community.bistudio.com/wiki/Arma_Reforger:Scripting:_Values#Typename
It seems outdated, something is broken or I am broken.
This page shows example code work converting from typename to string and back again.
https://community.bistudio.com/wiki/Arma_Reforger:Scripting:_Values#Typename
It seems outdated, something is broken or I am broken.
Per example...
1 class ObjectClass 2 { 3 int Health = 100; 4 } 5 6 typename t; // t is null 7 t = ObjectClass; 8 string classname = TypeName(t); // returns "ObjectClass"; 9 t = Type(classname); // returns ObjectClass typename too
Line 8 throws "Undefined function TypeName", I've searched the codebase and don't find any such proto function.
Think this should be
8 string classname = t.ToString(); // returns "ObjectClass";
After that change, I now get error line 9 "Too many parameters for 'Type' method". Class::Type() takes no parameters.
My aim here, if it's by some other method, is to instantiate my classes by string name
I'm guessing this is done via something like that. But I already know I'm barking up the wrong tree because this throws "Unknown type 't'" line 2
1 typename t = ObjectClass; 2 t myt = new t(); 3 Print(myt.Health);
Just noticed the page is for Arma Reforger scripting, is that even the same as Enforce script for DayZ ? perhaps that's my problem :)
Hello davezap.
Reforger scripting documentation is very likely not accurate way to go by when trying to mod DayZ