Announcement

Collapse
No announcement yet.

Static compile-time initialization of structures?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Not supported I think.
    You need to set each variable seperatly: YYY[0].z1 = 'Test'; ...

    But you can use the defaultproperties for global variables:
    Code:
    defaultproperties
    {
      YYY(0)=(z1='Test',z2=0.5,z3=0.32,z4=true)
      YYY(1)=(z1='Test2',z2=1.2,z3=2.5,z4=false)
    }
    When the object is created the array contains these values (and of course the "default" version of the array, too).

    Leave a comment:


  • started a topic Static compile-time initialization of structures?

    Static compile-time initialization of structures?

    I want to use a static array of struct in my script, but ucc seem unable to parse the standard 'C' style compile-time initialization syntax. Is there a special syntax, or is static intialization of structures simply not supported?

    example:

    struct XXX
    {
    var name z1;
    var float z2;
    var float z3;
    var bool z4;
    };

    // The array of XXX structures

    var XXX YYY[2] =
    {
    {'bummer',1.0,2.0,True},
    {'hopeless',3.0,4.0,False},
    };

    Thanks!
Working...
X