ug4
ug::LuaFunction< TData, TDataIn > Class Template Reference

#include <lua_user_data.h>

+ Inheritance diagram for ug::LuaFunction< TData, TDataIn >:

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_Statem_L
 lua state More...
 
size_t m_numArgs
 number of arguments to use More...
 

Detailed Description

template<typename TData, typename TDataIn>
class ug::LuaFunction< TData, TDataIn >

Template Parameters
TDataReturn value type
TDataInInput daten type

Constructor & Destructor Documentation

◆ LuaFunction()

template<typename TData , typename TDataIn >
ug::LuaFunction< TData, TDataIn >::LuaFunction

◆ ~LuaFunction()

template<typename TData , typename TDataIn >
virtual ug::LuaFunction< TData, TDataIn >::~LuaFunction ( )
inlinevirtual

Member Function Documentation

◆ operator()()

template<typename TData , typename TDataIn >
void ug::LuaFunction< TData, TDataIn >::operator() ( TData &  out,
int  numArgs,
  ... 
)
virtual

◆ set_lua_callback()

template<typename TData , typename TDataIn >
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().

Member Data Documentation

◆ m_cbValueName

template<typename TData , typename TDataIn >
std::string ug::LuaFunction< TData, TDataIn >::m_cbValueName
protected

callback name as string

◆ m_cbValueRef

template<typename TData , typename TDataIn >
int ug::LuaFunction< TData, TDataIn >::m_cbValueRef
protected

reference to lua function

Referenced by ug::LuaFunction< TData, TDataIn >::LuaFunction().

◆ m_L

template<typename TData , typename TDataIn >
lua_State* ug::LuaFunction< TData, TDataIn >::m_L
protected

◆ m_numArgs

template<typename TData , typename TDataIn >
size_t ug::LuaFunction< TData, TDataIn >::m_numArgs
protected

number of arguments to use


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