lua::argument Class Reference

argument of a Lua glue More...

#include <luapp_function.hpp>

List of all members.

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.
dataget_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_
datapData_
std::vector< datalData_
functionpParent_
statepLua_

Friends

class function

Detailed Description

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 & Destructor Documentation

lua::argument::argument ( const std::string &  sName,
type  mLuaType,
function pParent 
)

Constructor.

Parameters:
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.


Member Function Documentation

void lua::argument::add ( const std::string &  sName,
type  mLuaType 
)

Adds an alternative to this argument.

Parameters:
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.

template<class T >
T* lua::argument::get (  )  const [inline]

Returns the value as userdata.

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.

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.

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.

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.

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.

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.

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).

Returns:
'true' if the user has provided this argument

Definition at line 46 of file luapp_argument.cpp.

void lua::argument::set_data ( data pdata  ) 

Sets this argument's data.

Parameters:
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).

Parameters:
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
Returns:
'true' if everything went fine

Definition at line 51 of file luapp_argument.cpp.


Friends And Related Function Documentation

friend class function [friend]

Definition at line 69 of file luapp_function.hpp.


Member Data Documentation

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.

Definition at line 146 of file luapp_function.hpp.

Definition at line 149 of file luapp_function.hpp.

Definition at line 148 of file luapp_function.hpp.


The documentation for this class was generated from the following files:

Generated on Sun Apr 29 19:27:30 2012 for lua++ by  doxygen 1.6.1