diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 2cbedf80f..539ac763b 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -500,6 +500,15 @@ void FGNasalSys::createModule(const char* moduleName, const char* fileName, hashset(_globals, moduleName, locals); } +void FGNasalSys::deleteModule(const char* moduleName) +{ + naRef modname = naNewString(_context); + naStr_fromdata(modname, (char*)moduleName, strlen(moduleName)); + naModLock(); + naHash_delete(_globals, modname); + naModUnlock(); +} + naRef FGNasalSys::parse(const char* filename, const char* buf, int len) { int errLine = -1; diff --git a/src/Scripting/NasalSys.hxx b/src/Scripting/NasalSys.hxx index ec9b8d3d0..669b26eea 100644 --- a/src/Scripting/NasalSys.hxx +++ b/src/Scripting/NasalSys.hxx @@ -54,6 +54,8 @@ public: void createModule(const char* moduleName, const char* fileName, const char* src, int len); + void deleteModule(const char* moduleName); + private: friend class FGNasalScript; friend class FGNasalListener; @@ -101,6 +103,7 @@ private: public: void handleTimer(NasalTimer* t); }; + class FGNasalScript { public: ~FGNasalScript() { _nas->gcRelease(_gcKey); } @@ -118,6 +121,7 @@ private: FGNasalSys* _nas; }; + class FGNasalListener : public SGPropertyChangeListener { public: FGNasalListener(SGPropertyNode_ptr node, naRef handler,