Page MenuHomeFeedback Tracker

Undefined function TypeName
Reviewed, UrgentPublic

Description

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.

Details

Severity
Trivial
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Operating System Version
22H2 Build 22621.2070 "Windows Feature Experience Pack 1000.22659.1000.0"
Category
General
Steps To Reproduce

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.

Additional Information

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);

Event Timeline

davezap created this task.Aug 1 2023, 9:42 AM

Just noticed the page is for Arma Reforger scripting, is that even the same as Enforce script for DayZ ? perhaps that's my problem :)

Geez changed the task status from New to Reviewed.Aug 1 2023, 11:17 AM
Geez added a subscriber: Geez.

Hello davezap.
Reforger scripting documentation is very likely not accurate way to go by when trying to mod DayZ

:) Good to know. Thanks.