Recursion and file-IO in CelX ???

All about writing scripts for Celestia in Lua and the .cel system
Avatar
Topic author
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Recursion and file-IO in CelX ???

Post #1by Chuft-Captain » 10.03.2006, 23:56

Does anyone know if it's possible to write a recursive function in CelX scripts. I'd like to write a little script to reverse the order of bookmarks in favorites.cel.

Best way to do this would be to read each of the items in the file and write them back out recursively. (Might have to create a duplicate of the file first).

Or even better, someone could write this in C++ and include it as a permanent feature in the next release! (ie. Sort order option on the Bookmarks menu)

Any volunteers?? :)
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

cpotting
Posts: 164
Joined: 18.03.2004
Age: 63
With us: 20 years 8 months
Location: Victoria, BC Canada

Post #2by cpotting » 16.03.2006, 15:02

Creating functions (recursive or otherwise) and file I/O are both possible with Celx scripts. Cel scripting, however, does not support either.
Clive Pottinger
Victoria, BC Canada

Avatar
Topic author
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Post #3by Chuft-Captain » 16.03.2006, 15:18

Thanks Clive,

I thought I might do this if others might find it useful, but at the moment the results of my poll: http://celestiaproject.net/forum/viewtopic.php ... highlight= suggest not. 4 votes from 210 views. (Or maybe it's just typical american voting apathy :wink:)

Might get around to this one day, but bigger fish to fry, so in the meantime I'll continue to edit favorites.cel as I've been doing up to now.

Thanks for the feedback though.
:)
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS


Return to “Scripting”