fuction "require"

All about writing scripts for Celestia in Lua and the .cel system
Topic author
rinoa79
Posts: 42
Joined: 20.11.2007
Age: 45
With us: 17 years 2 months
Location: Milan, Italy

fuction "require"

Post #1by rinoa79 » 06.06.2008, 14:21

i've been using celestia 1.4 until today, and I normally use the function "require" to get an external function, but now with the new 1.5 release with the same function i get an error, "[string "C:\....\..celx"]:7: attempt to call global "require" (a nil value)".
then celestia stop. is there any new function similar to "require" or there is something wrong with my call?

thanks in advance.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 4 months
Location: NY, USA

Re: fuction "require"

Post #2by selden » 06.06.2008, 15:01

Celestia v1.5 requires (*ahem*) that you include the following at the beginning of any script which does file I/O or O/S calls:

Code: Select all

celestia:requestsystemaccess()

It'll ask the user if I/O access may be allowed.

For details, see
http://en.wikibooks.org/wiki/Celestia/C ... stemaccess

Annoyingly, this is required for the functions which are used to organize Lua code, like the require statement.
Selden

Topic author
rinoa79
Posts: 42
Joined: 20.11.2007
Age: 45
With us: 17 years 2 months
Location: Milan, Italy

Re: fuction "require"

Post #3by rinoa79 » 08.06.2008, 18:56

Thanks!
It works now! :D


Return to “Scripting”