GemaLuaCoreLib
The GeMA Lua Core library
Namespaces | Functions
gmLuaUtils.cpp File Reference

Implementation of utilitary functions for working with Lua. More...

#include "gmLuaUtils.h"
#include "gmLuaEnv.h"
#include "gmLuaMatrix.h"
#include <luaTable.h>
#include <gmTrace.h>
#include <gmVectorUtils.h>
#include <gmStateDump.h>
Include dependency graph for gmLuaUtils.cpp:

Namespaces

 GmLuaUtils
 Groups utilitary routines for working with Lua.
 

Functions

void GmLuaUtils::fillVectorFromLua (lua_State *L, int stackPos, QString fname, GmVector &v)
 Resizes and fills the vector v to receive the data stored in a lua table.
 
void GmLuaUtils::checkAndLoadIntOption (LuaTable &optionsTable, const char *fieldName, int *option)
 An auxiliary function used to check the existance and validity of an integer option. If the field doesn't exists, does nothing (keep default value). Otherwise, if the field is an integer, fills option with its value. Otherwise (invalid value), raises an error.
 
void GmLuaUtils::checkAndLoadUnsignedOption (LuaTable &optionsTable, const char *fieldName, unsigned *option)
 An auxiliary function used to check the existance and validity of a unsigned integer option. If the field doesn't exists, does nothing (keep default value). Otherwise, if the field is an unsigned, fills option with its value. Otherwise (invalid value), raises an error.
 
void GmLuaUtils::checkAndLoadDoubleOption (LuaTable &optionsTable, const char *fieldName, double *option)
 An auxiliary function used to check the existance and validity of a double option. If the field doesn't exists, does nothing (keep default value). Otherwise, if the field is a number, fills option with its value. Otherwise (invalid value), raises an error.
 
void GmLuaUtils::checkAndLoadTaskOptions (LuaTable &optionsTable, int *nworkers, int *ntasks, GmTaskManager::NodePartitionStrategy *nodeStrategy, GmTaskManager::CellPartitionStrategy *cellStrategy)
 An auxiliary function used to load task manager options from optionsTable, filling nworkers, ntasks, nodeStrategy and cellStrategy. If any of the parameters is NULL, the option will be ignored. More...
 
int GmLuaUtils::stringOptionIndex (QString value, const char **optionNames, lua_State *L, const char *fieldName)
 Looks for value in optionNames. If found returns the index. If not found raises a lua error for field fieldName.
 

Detailed Description

Implementation of utilitary functions for working with Lua.

Author
Erwan Yann Renaut
Date
december, 2015