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
FGNasalScript* parseScript(const char* src, const char* name=0);
// Implementation of the settimer extension function
- void setTimer(naRef args);
+ void setTimer(int argc, naRef* args);
// Returns a ghost wrapper for the current _cmdArg
naRef cmdArgGhost();
// 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;
};
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);
~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;
}