X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScripting%2FNasalSys.hxx;h=4d59b8b2c8aa2908813dcbf14c610719affdd7dc;hb=9c28ed02577e6d32e1365567107adbd048f3d743;hp=01404a06470163f66b731e92b79bea3160c4f29a;hpb=142854d3d191817784fd15d9d51ba3742b9ce26c;p=flightgear.git diff --git a/src/Scripting/NasalSys.hxx b/src/Scripting/NasalSys.hxx index 01404a064..4d59b8b2c 100644 --- a/src/Scripting/NasalSys.hxx +++ b/src/Scripting/NasalSys.hxx @@ -15,6 +15,10 @@ public: virtual void init(); virtual void update(double dt) { /* noop */ } + // Loads a nasal script from an external file and inserts it as a + // global module of the specified name. + void loadModule(SGPath file, const char* moduleName); + // Simple hook to run arbitrary source code. Returns a bool to // indicate successful execution. Does *not* return any Nasal // values, because handling garbage-collected objects from C space @@ -38,6 +42,9 @@ public: // Callbacks for command and timer bindings virtual bool handleCommand(const SGPropertyNode* arg); + void createModule(const char* moduleName, const char* fileName, + const char* src, int len); + private: friend class FGNasalScript; @@ -54,12 +61,9 @@ private: }; void loadPropertyScripts(); - void initModule(const char* moduleName, const char* fileName, - const char* src, int len); - void readScriptFile(SGPath file, const char* lib); void hashset(naRef hash, const char* key, naRef val); void logError(); - naRef parse(const char* filename, const char* buf, int len=0); + naRef parse(const char* filename, const char* buf, int len); naRef genPropsModule(); naRef propNodeGhost(SGPropertyNode* handle); @@ -88,7 +92,7 @@ public: ~FGNasalScript() { _nas->gcRelease(_gcKey); } bool call() { - naCall(_nas->_context, _code, naNil(), naNil(), naNil()); + naCall(_nas->_context, _code, 0, 0, naNil(), naNil()); return naGetError(_nas->_context) == 0; }