Board index FlightGear Development Nasal

Nasal string function replace() where is it documented ?

Nasal is the scripting language of FlightGear.

Nasal string function replace() where is it documented ?

Postby mhab » Mon May 16, 2016 4:36 pm

Hello
I was wondering where to find a decription of the string function replace(string,str_old,str_new), join(), etc.. ?
It's not core functions and not extension functions as it seems ?

But they are defined in "string.nas" ... so where is the place to document this if anyhow ?

Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: Nasal string function replace() where is it documented ?

Postby PINTO » Mon May 16, 2016 4:45 pm

Most of the functions inside the $FG_DATA/Nasal/ folder are undocumented except for in that specific nasal file. The file usually contains the documentation.
Actively developing the MiG-21bis (github repo) (forum thread) (dev discord) (fg wiki)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 966
Joined: Wed Oct 21, 2015 7:28 pm
Callsign: pinto
Version: stable
OS: Win10

Re: Nasal string function replace() where is it documented ?

Postby mhab » Sat May 21, 2016 10:48 am

Hello

I have invested some effort to fill the http://wiki.flightgear.org/Nasal_String_Manipulation page.
It had been sitting around for a while and I thought it would have helped me.

Please anyone with more experience check the contents for consistency.

Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: Nasal string function replace() where is it documented ?

Postby Hooray » Sat May 21, 2016 11:53 am

Wow, thanks for doing this !

PS: Note that there is a Nasal/cppbind (wiki) implementation that helps implement std::string-like functionality (IIRC)
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Nasal string function replace() where is it documented ?

Postby mhab » Sat May 21, 2016 5:51 pm

Hello

I also added some file handling descriptions from "Nasal/io.nas" to the Wiki page http://wiki.flightgear.org/Nasal_File_I/O.

Remark: couldn't find anything about creating or writing a file from Nasal ...

Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: Nasal string function replace() where is it documented ?

Postby PINTO » Sat May 21, 2016 6:07 pm

For other I/O, check https://web.archive.org/web/20101010094553/http://plausible.org/nasal/lib.html. Not sure if/how it's implemented though, I've only ever used that io.write_properties() function.
Actively developing the MiG-21bis (github repo) (forum thread) (dev discord) (fg wiki)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 966
Joined: Wed Oct 21, 2015 7:28 pm
Callsign: pinto
Version: stable
OS: Win10

Re: Nasal string function replace() where is it documented ?

Postby mhab » Sat May 21, 2016 7:14 pm

Thanks for the hint.

I added the related functions in the Wiki page, as the plausible.org web page is not easily usable since it is down ;-)
Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: Nasal string function replace() where is it documented ?

Postby Hooray » Sat May 21, 2016 7:21 pm

See:

http://wiki.flightgear.org/Template:IO_Restrictions
https://sourceforge.net/p/flightgear/fl ... String.cxx

Note that there's $FG_ROOT/Nasal/string.nas AND Nasal/std/string.nas

Besides, you may want to get in touch with Red Leader who's been documenting most Nasal APIs so far.

PS: Actually, there already is a Python script that parses $FG_ROOT/Nasal to create up-to-date Nasal docs from it, see Adrian's script: viewtopic.php?f=72&t=25119
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Nasal

Who is online

Users browsing this forum: No registered users and 2 guests