This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Access to $index property in instance$static$init

Hello,


I am attempting to get access to the $index property of a statically created instance. Using the passed in obj parameter (obj.$index) does not work.

What is the best method for getting access to it in the instance$static$init function.


Thanks!

  • The first parameter for that function is an instance object, which correspond to the Instance_State declared in the xdc spec file. The object does not have the property $index. The second parameter is a config-time description of an instance, and that's where you can find various properties of an instance, $index, $package, $module etc.
    So, this is what you need:

    instance$static$init(obj, inst, mod) {
        print(inst.$index);
    }

  • Ahh, that makes more sense. I've always treated the second parameter as just the parameters structure. I never put two and two together and realized that. Thanks for the help!