1. Can multiple LuaHooks be made to work?
Having only one makes it awkward to add multiple sets of features written in Lua.
For example, one might like to include a script which checks official servers for official updates to orbital parameters while also having Vincent's LuaEdu script installed.
2. When does the initial LuaHook processing take place compared to when catalogs are loaded?
In other words, can one create catalogs from the LuaHook environment which will immediately be used? Or would Celestia have to be restarted?
NOTE I am not planning to implement any autoupdate script myself. i'm just wondering about the feasability of doing it in Lua instead of adding yet another library requirement to Celestia.
Multiple LuaHooks? Time of LuaHook initialization?
- t00fri
- Developer
- Posts: 8772
- Joined: 29.03.2002
- Age: 22
- With us: 22 years 7 months
- Location: Hamburg, Germany
On this occasion of Selden's question, let me touch upon a somewhat heretic "counter"-question:
Please note, I have myself often supported the idea of delegating certain tasks to Lua. E.g. for picking and marking certain kinds of objects Lua is great and amounts to just a few lines of scripting code.
Yet, at present the Celestia specific Lua functions and thus the Lua scripting complexity keep growing strongly, while their documentation tends to stagnate.
So I ask myself, whether a piece of cleanly structured C++ code in the core wouldn't often be the better alternative for the more complex tasks of general interest!?
Certainly, Lua is the weapon of the "free-lance" add-on creators, unlike C++ code, which typically requires some arguing with the devs about usefulness etc.
I am certainly aware of a number of intrinsic advantages for doing certain tasks with Lua scripting code:
-- cross-platform
-- no compilation necessary
-- no C++ knowledge necessay
But when the arsenal of custom functions gets larger and larger, a number of the above 'pros' are loosing weight in my view.
Now we are starting to talk about multiple Lua hooks
Bye Fridger
Please note, I have myself often supported the idea of delegating certain tasks to Lua. E.g. for picking and marking certain kinds of objects Lua is great and amounts to just a few lines of scripting code.
Yet, at present the Celestia specific Lua functions and thus the Lua scripting complexity keep growing strongly, while their documentation tends to stagnate.
So I ask myself, whether a piece of cleanly structured C++ code in the core wouldn't often be the better alternative for the more complex tasks of general interest!?
Certainly, Lua is the weapon of the "free-lance" add-on creators, unlike C++ code, which typically requires some arguing with the devs about usefulness etc.
I am certainly aware of a number of intrinsic advantages for doing certain tasks with Lua scripting code:
-- cross-platform
-- no compilation necessary
-- no C++ knowledge necessay
But when the arsenal of custom functions gets larger and larger, a number of the above 'pros' are loosing weight in my view.
Now we are starting to talk about multiple Lua hooks
Bye Fridger
Re: Multiple LuaHooks? Time of LuaHook initialization?
Only one LuaHook init script is loaded at startup. But a master init script can be writen which loads other LuaHook scripts. So an init script could be written that updates the catalogs and also loads Vincent's LuaEdu script.selden wrote:1. Can multiple LuaHooks be made to work?
Having only one makes it awkward to add multiple sets of features written in Lua.
For example, one might like to include a script which checks official servers for official updates to orbital parameters while also having Vincent's LuaEdu script installed.
I believe the LuaHook init script is loaded immediately after the configutation file is read, before the catalogs are read. So the catalogs could be updated before they're read. It wouldn't be necessary to restart.selden wrote:2. When does the initial LuaHook processing take place compared to when catalogs are loaded?
In other words, can one create catalogs from the LuaHook environment which will immediately be used? Or would Celestia have to be restarted?
selden wrote:NOTE I am not planning to implement any autoupdate script myself. i'm just wondering about the feasability of doing it in Lua instead of adding yet another library requirement to Celestia.
Yes, it should be feasible to use Lua for this.
I've been doing some experiments to explore the possibility a cross-platform version of Celestia using Lua to implement the application control logic (including the GUI). An autoupdate feature could easily be incorporated with this approach.
- Hank
-
Topic authorselden
- Developer
- Posts: 10192
- Joined: 04.09.2002
- With us: 22 years 2 months
- Location: NY, USA
I think there are several other somewhat related reasons for using Lua:
4. adding functionality to Celestia without affecting or being affected by ongoing changes in the central repository code.
5. quick prototyping of functionality
6. private modifications that never will be made public
7. and, of course, to provide specialized functionality within Addons which are not intended to be central to the use of Celestia. (I'm thinking primarily of ScriptedOrbits and ScriptedRotations used to move, orient and animate individual spacecraft.)
I agree that appropriate documentation does need to be included when scripts are released for public use. (I tried to include appropriate inline comments in my script 6view.celx, for example, but it has a relatively limited purpose.)
4. adding functionality to Celestia without affecting or being affected by ongoing changes in the central repository code.
5. quick prototyping of functionality
6. private modifications that never will be made public
7. and, of course, to provide specialized functionality within Addons which are not intended to be central to the use of Celestia. (I'm thinking primarily of ScriptedOrbits and ScriptedRotations used to move, orient and animate individual spacecraft.)
I agree that appropriate documentation does need to be included when scripts are released for public use. (I tried to include appropriate inline comments in my script 6view.celx, for example, but it has a relatively limited purpose.)
Selden