Forum Discussion
howie_
11 years agoContributor
Hey Robert,
First off I want to thank you for pointing me toward Script Extensions. I've been playing with them all day, and I'm really excited about what they mean not only for my work, but for next guy who has to maintain my work (probably me, but that's neither here nor there).
I do have one question. I've created an object, "Person", and for our project I'm going to need about 150 of them. Is there any way that I can use the "new" keyword to create multiple instances of the "Person" object? So far all I'm getting is a static/singleton-type object. Any advice?
-Howie
For clarification, here's what I can do now:
--------------------------------------------------------
var a = Person;
var b = Person;
a.Age= 10;
b.Age = 3;
Log.Message(a.Age + ", " + b.Age);
>> 3, 3
What I'd like to do:
-----------------------------------
var a = new Person();
var b = new Person();
a.Age= 10;
b.Age = 3;
Log.Message(a.Age + ", " + b.Age);
>> 10, 3
First off I want to thank you for pointing me toward Script Extensions. I've been playing with them all day, and I'm really excited about what they mean not only for my work, but for next guy who has to maintain my work (probably me, but that's neither here nor there).
I do have one question. I've created an object, "Person", and for our project I'm going to need about 150 of them. Is there any way that I can use the "new" keyword to create multiple instances of the "Person" object? So far all I'm getting is a static/singleton-type object. Any advice?
-Howie
For clarification, here's what I can do now:
--------------------------------------------------------
var a = Person;
var b = Person;
a.Age= 10;
b.Age = 3;
Log.Message(a.Age + ", " + b.Age);
>> 3, 3
What I'd like to do:
-----------------------------------
var a = new Person();
var b = new Person();
a.Age= 10;
b.Age = 3;
Log.Message(a.Age + ", " + b.Age);
>> 10, 3
Related Content
Recent Discussions
- 15 hours agotramuntana
- 3 days agoSlickRick