|
LRAUV
revA
|
A wrapper for the lua programming language interface. More...
#include <LuaAPI.h>


Classes | |
| class | LuaState |
Public Member Functions | |
| virtual | ~LuaAPI () |
| virtual ScriptNode * | makeScriptFunction (const char *moduleName, const char *componentName, const char *methodName, FlexArray< InputInfo * > &inputs, FlexArray< SettingInfo * > &settings, const char *code, Logger &logger) |
| Returns a ScriptNode within the namespace of componentName that contains a function with the given methodName, with arguments of the given inputNames, with the indicated code. More... | |
Public Member Functions inherited from ScriptAPI | |
| virtual | ~ScriptAPI () |
| Destructor. More... | |
Static Protected Member Functions | |
| static const char * | LoadFile (const char *filename) |
| Loads the indicated file. More... | |
| static const char * | Exec (const char *command) |
| Runs the specified command, with no return. More... | |
| static bool | Exec (FlexArray< DataReader * > *inputs, FlexArray< SettingReader * > *settings, bool &boolValue, FlexArray< DataWriter * > *outputs, FlexArray< const Unit * > *outUnits, Logger &logger) |
| Runs the function on top of the stack with the indicated args and returns the indicated outputs. More... | |
| static const char * | Run () |
| Runs whatever is on top of the stack with no args and no return. More... | |
| static const char * | RunFunction (const char *functionName, Str &returnValue, bool isRoot=false) |
| Runs specified function from the currently open table. More... | |
| static bool | IsTable (bool isRoot) |
| Is the item at the top of the stack a table? More... | |
| static bool | OpenTableItemByIndex (int index, bool isRoot) |
| Opens an item from the table on the top of the stack by its zero-based index it must be closed later with CloseTableItem() More... | |
| static bool | OpenTableItemByName (const char *name, bool isRoot) |
| Opens an item from the table on the top of the stack by its name it must be closed later with CloseTableItem() More... | |
| static void | PushNil () |
| Pushes a nil onto the stack. More... | |
| static int | GetStackHeight () |
| returns the height of the stack More... | |
| static int | GetTableSize (bool isRoot) |
| Returns the size of the table on the top of the stack Returns -1 if not a table. More... | |
| static void | CloseTableItem () |
| Just pops the top item off the lua stack. More... | |
| static bool | GetBool (bool &readTo, bool isRoot) |
| gets a boolean from the top of the stack More... | |
| static bool | GetNumber (double &readTo, bool isRoot) |
| gets a number from the top of the stack More... | |
| static bool | GetString (Str &readTo, bool isRoot) |
| gets a unsigned char string from the top of the stack More... | |
| static bool | NewTable (const char *name, bool isRoot) |
| creates a new empty table and adds to open node, returns true if successful More... | |
| static const char * | NewFunction (const char *functionName, const char *functionBody, bool isRoot) |
| creates a new function and adds to open node, returns error message if error More... | |
Static Protected Attributes | |
| static LuaState | LUA_ |
Private Member Functions | |
| LuaAPI (const LuaAPI &old) | |
| LuaAPI () | |
| Private constructor for singleton. More... | |
Private Attributes | |
| LuaNode * | rootNode_ |
Static Private Attributes | |
| static LuaAPI | Instance_ |
Friends | |
| class | LuaMissionAPI |
| class | LuaNode |
Additional Inherited Members | |
Protected Member Functions inherited from ScriptAPI | |
| ScriptAPI (const char *name, const char *extension) | |
| Protected constructor for ABC. More... | |
| ScriptAPI () | |
| Note that the default constructor below is private and not given a body. More... | |
| ScriptAPI (const ScriptAPI &old) | |
| Note that the copy constructor below is private and not given a body. More... | |
A wrapper for the lua programming language interface.
Allows scripted modules and components to share much of the same API as c++ modules and components. Works closely with Tethys.lua code.
|
virtual |
References rootNode_.
|
private |
|
private |
Private constructor for singleton.
|
staticprotected |
Just pops the top item off the lua stack.
Just pops the top item off the LUA_ stack.
References LUA_.
Referenced by LuaNode::close(), LuaNode::getIndexedNode(), LuaNode::getNamedNode(), and NewFunction().
|
staticprotected |
Runs the specified command, with no return.
Returns pointer to error message if unable to do so.
References LUA_.
Referenced by LuaNode::execute(), and LuaMissionAPI::loadMissionFile().
|
staticprotected |
Runs the function on top of the stack with the indicated args and returns the indicated outputs.
Runs the function on top of the stack with the indicated args and sets the indicated outputs.
If boolValue is true, it will be set to the single boolean result of the function.
Returns true on success.
References Syslog::CRITICAL, FlexArray< T >::get(), DataReader::getDefaultUnit(), SettingReader::getDefaultUnit(), LUA_, Units::NONE, SettingReader::read(), DataReader::read(), FlexArrayBase::size(), Syslog::StringToSeverity(), Logger::syslog(), and DataWriter::write().
|
staticprotected |
|
staticprotected |
|
staticprotected |
returns the height of the stack
References LUA_.
|
staticprotected |
gets a unsigned char string from the top of the stack
References LUA_.
Referenced by LuaNode::readString(), and RunFunction().
|
staticprotected |
Returns the size of the table on the top of the stack Returns -1 if not a table.
References IsTable(), and LUA_.
Referenced by LuaNode::getNodeCount().
|
staticprotected |
Is the item at the top of the stack a table?
References LUA_.
Referenced by LuaNode::getNodeCount(), GetTableSize(), LuaNode::hasChildNodes(), OpenTableItemByIndex(), and OpenTableItemByName().
|
staticprotected |
Loads the indicated file.
loads the indicated file.
Returns pointer to error message if unable to do so.
References LUA_.
Referenced by LuaMissionAPI::loadMissionFile().
|
virtual |
Returns a ScriptNode within the namespace of componentName that contains a function with the given methodName, with arguments of the given inputNames, with the indicated code.
Implements ScriptAPI.
References LuaNode::getNamedNode(), LuaNode::newChildFunction(), LuaNode::newChildNode(), rootNode_, and FlexArrayBase::size().
|
staticprotected |
creates a new function and adds to open node, returns error message if error
References CloseTableItem(), Str::cStr(), and LUA_.
Referenced by LuaNode::newChildFunction().
|
staticprotected |
creates a new empty table and adds to open node, returns true if successful
References LUA_.
Referenced by LuaNode::newChildNode().
|
staticprotected |
Opens an item from the table on the top of the stack by its zero-based index it must be closed later with CloseTableItem()
opens an item from the table on the top of the stack by its zero-based index it must be closed later with CloseTable()
References IsTable(), LUA_, and PushNil().
Referenced by LuaNode::getIndexedNode(), and LuaNode::open().
|
staticprotected |
Opens an item from the table on the top of the stack by its name it must be closed later with CloseTableItem()
opens an item from the table on the top of the stack by its name it must be closed later with CloseTable()
References IsTable(), LUA_, and PushNil().
Referenced by LuaNode::getNamedNode(), and LuaNode::open().
|
staticprotected |
Pushes a nil onto the stack.
References LUA_.
Referenced by LuaNode::execute(), OpenTableItemByIndex(), and OpenTableItemByName().
|
staticprotected |
Runs whatever is on top of the stack with no args and no return.
Returns pointer to error message if unable to do so.
References LUA_.
Referenced by LuaMissionAPI::loadMissionFile().
|
staticprotected |
Runs specified function from the currently open table.
Returns pointer to error message if unable to do so.
References GetString(), and LUA_.
Referenced by LuaMissionAPI::loadMissionFile().
|
friend |
|
friend |
|
staticprivate |
|
staticprotected |
Referenced by CloseTableItem(), Exec(), GetBool(), GetNumber(), GetStackHeight(), GetString(), GetTableSize(), IsTable(), LoadFile(), NewFunction(), NewTable(), OpenTableItemByIndex(), OpenTableItemByName(), PushNil(), Run(), and RunFunction().
|
private |
Referenced by makeScriptFunction(), and ~LuaAPI().