instantiate object from string
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2009 at 06:23, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Mac ;
Language(s) : C.O.F.F.E.E ;---------
Hi,Is there any way to create an instance of an object given the class name as a string? Like:
var className = "myClass";
var myObject = new(className, ...);Does anybody know any trick or workaround to make this work?
Thanks in advance for your help,
Gambetti -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2009 at 13:04, xxxxxxxx wrote:
I don't think this is possible as the 'className' is a class nomenclature held by the interpreter/compiler and endemic to the actual code. There might be a trick to have text inserted into the code (as meta-code) but it would be precarious for certain.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2009 at 15:53, xxxxxxxx wrote:
Oh yes, of course, what a silly idea. I'm used to do this in interpreted languages like PHP, but of course this can't work with COFFEE.
Cheers,
Gambetti