argument of a Lua glue More...
#include <luapp_function.hpp>
Public Member Functions | |
argument (const std::string &sName, type mLuaType, function *pParent) | |
Constructor. | |
void | add (const std::string &sName, type mLuaType) |
Adds an alternative to this argument. | |
data * | get_data () const |
Returns the associated data. | |
float | get_number () const |
Returns the value and converts it to a float. | |
bool | get_bool () const |
Returns the value and converts it to a bool. | |
std::string | get_string () const |
Returns the value and converts it to a string. | |
template<class T > | |
T * | get () const |
Returns the value as userdata. | |
int | get_index () const |
Returns the value and converts it to an int. | |
type | get_type () const |
Returns the actual type of this value. | |
bool | is_provided () const |
Checks if this argument has been provided (in case it is optional). | |
void | set_data (data *pdata) |
Sets this argument's data. | |
Private Member Functions | |
bool | test (state *pLua, int iIndex, bool bPrintError=true) |
Checks if this argument has the expected type(s). | |
Private Attributes | |
bool | bSet_ |
data * | pData_ |
std::vector< data > | lData_ |
function * | pParent_ |
state * | pLua_ |
Friends | |
class | function |
argument of a Lua glue
Used internally by function.
If, for some reason, you need to add an argument without using function's interface, please let me know on the forums and I'll try to see what can be done.
Definition at line 67 of file luapp_function.hpp.
Constructor.
sName | The name of this argument (used to print errors in the log) | |
mLuaType | The expected type in Lua | |
pParent | A pointer to the function that'll be using it |
Definition at line 7 of file luapp_argument.cpp.
void lua::argument::add | ( | const std::string & | sName, | |
type | mLuaType | |||
) |
Adds an alternative to this argument.
sName | The name of this alternative argument (used to print errors in the log) | |
mLuaType | The expected type in Lua |
Definition at line 14 of file luapp_argument.cpp.
T* lua::argument::get | ( | ) | const [inline] |
Returns the value as userdata.
Definition at line 109 of file luapp_function.hpp.
bool lua::argument::get_bool | ( | ) | const |
Returns the value and converts it to a bool.
Definition at line 26 of file luapp_argument.cpp.
data * lua::argument::get_data | ( | ) | const |
Returns the associated data.
Definition at line 114 of file luapp_argument.cpp.
int lua::argument::get_index | ( | ) | const |
Returns the value and converts it to an int.
Definition at line 36 of file luapp_argument.cpp.
float lua::argument::get_number | ( | ) | const |
Returns the value and converts it to a float.
Definition at line 21 of file luapp_argument.cpp.
std::string lua::argument::get_string | ( | ) | const |
Returns the value and converts it to a string.
Definition at line 31 of file luapp_argument.cpp.
type lua::argument::get_type | ( | ) | const |
Returns the actual type of this value.
Definition at line 41 of file luapp_argument.cpp.
bool lua::argument::is_provided | ( | ) | const |
Checks if this argument has been provided (in case it is optional).
Definition at line 46 of file luapp_argument.cpp.
void lua::argument::set_data | ( | data * | pdata | ) |
Sets this argument's data.
pdata | A pointer to the good data |
Definition at line 108 of file luapp_argument.cpp.
bool lua::argument::test | ( | state * | pLua, | |
int | iIndex, | |||
bool | bPrintError = true | |||
) | [private] |
Checks if this argument has the expected type(s).
pLua | The Lua state to use | |
iIndex | The index to check | |
bPrintError | Set to 'false' if you don't want that function to print errors in the log |
Definition at line 51 of file luapp_argument.cpp.
friend class function [friend] |
Definition at line 69 of file luapp_function.hpp.
bool lua::argument::bSet_ [private] |
Definition at line 145 of file luapp_function.hpp.
std::vector<data> lua::argument::lData_ [private] |
Definition at line 147 of file luapp_function.hpp.
data* lua::argument::pData_ [private] |
Definition at line 146 of file luapp_function.hpp.
state* lua::argument::pLua_ [private] |
Definition at line 149 of file luapp_function.hpp.
function* lua::argument::pParent_ [private] |
Definition at line 148 of file luapp_function.hpp.