ug4
|
#include <lua_user_data.h>
Public Member Functions | |
LuaFunction () | |
constructor More... | |
virtual void | operator() (TData &out, int numArgs,...) |
evaluates the data More... | |
void | set_lua_callback (const char *luaCallback, size_t numArgs) |
sets the Lua function used to compute the data More... | |
virtual | ~LuaFunction () |
Public Member Functions inherited from ug::IFunction< TData, TDataIn > | |
virtual | ~IFunction () |
virtual destructor More... | |
Protected Attributes | |
std::string | m_cbValueName |
callback name as string More... | |
int | m_cbValueRef |
reference to lua function More... | |
lua_State * | m_L |
lua state More... | |
size_t | m_numArgs |
number of arguments to use More... | |
TData | Return value type |
TDataIn | Input daten type |
ug::LuaFunction< TData, TDataIn >::LuaFunction |
constructor
References ug::script::GetDefaultLuaState(), ug::LuaFunction< TData, TDataIn >::m_cbValueRef, and ug::LuaFunction< TData, TDataIn >::m_L.
|
inlinevirtual |
|
virtual |
evaluates the data
Implements ug::IFunction< TData, TDataIn >.
References ug::IsFiniteAndNotTooBig(), PROFILE_CALLBACK_BEGIN, PROFILE_CALLBACK_END, read(), UG_ASSERT, UG_CATCH_THROW, UG_COND_THROW, and UG_THROW.
void ug::LuaFunction< TData, TDataIn >::set_lua_callback | ( | const char * | luaCallback, |
size_t | numArgs | ||
) |
sets the Lua function used to compute the data
This function sets the lua callback. The name of the function is passed as a string. Make sure, that the function name is defined when executing the script.
References UG_THROW.
Referenced by ug::MarkForCoarsen_ElementsByLuaCallback(), and ug::MarkForRefinement_ElementsByLuaCallback().
|
protected |
callback name as string
|
protected |
reference to lua function
Referenced by ug::LuaFunction< TData, TDataIn >::LuaFunction().
|
protected |
lua state
Referenced by ug::LuaFunction< TData, TDataIn >::LuaFunction().
|
protected |
number of arguments to use