Forum Discussion

neowinston's avatar
neowinston
Visitor
8 years ago

How do I pass a string to sub init() of XML file?

I need to pass a string to sub init() or any other function or field of a LabelList XML file. How do I do that? Thanks for your help!

2 Replies

  • destruk's avatar
    destruk
    Streaming Star
    Init is executed when the component is compiled, so I wouldn't think you would be able to 'pass' a value into it in Init from outside the component.  To set a variable within the init function you would just do that -- m.temp="Hello"

    You would be able to pass values into compiled components by making the value global so the component can pull from the global namespace, or by setting up a field in the xml to transfer values in and out of the component.

    <interface>
    <field id="mydata" type="string" />
    </interface>