Board index FlightGear Development Nasal

Nasal values in Xml params

Nasal is the scripting language of FlightGear.

Nasal values in Xml params

Postby clm76 » Wed Jun 06, 2018 5:14 pm

Hi,

Is it possible to use nasal variables as params in a xml file ?
Example : In this code, some properties are used as aliases to write checklists texts.
Code: Select all
<PropertyList>
...
  <params>
    <header>instrumentation/checklists/Tittle</header>
    <L0>instrumentation/checklists/L[0]</L0>
    <L1>instrumentation/checklists/L[1]</L1>
    <L2>instrumentation/checklists/L[2]</L2>
    <L3>instrumentation/checklists/L[3]</L3>
    <L4>instrumentation/checklists/L[4]</L4>
    ...
  </params>

I'd like to replace these properties by variables stored in a hash in a nasal file.
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3

Re: Nasal values in Xml params

Postby Thorsten » Sun Jun 10, 2018 9:42 am

Either there's something very profound about your question, or this is normal property I/O - you can use getprop/setprop or props.nas functions to read properties into Nasal variables and vice versa.
Thorsten
 
Posts: 10839
Joined: Mon Nov 02, 2009 8:33 am

Re: Nasal values in Xml params

Postby clm76 » Mon Jun 11, 2018 3:51 pm

Thanks Thorsten,

My goal was to remove many setprop/getprop in my checklists code but finally I’m rewriting it with Canvas structure.
clm76
 
Posts: 149
Joined: Tue Oct 30, 2012 8:18 pm
Location: France - LFOH
Callsign: F-GCLM
Version: 2018.3.0
OS: Linux Mint 18.3


Return to Nasal

Who is online

Users browsing this forum: No registered users and 6 guests