Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

LuaUtils Class Reference

#include <LuaUtils.hpp>

List of all members.

Static Public Member Functions

std::string getStringFromTable (struct lua_State *state, const char *key)
int getIntFromTable (struct lua_State *state, const char *key)
void setFieldOnTable (struct lua_State *state, const char *key, const char *value, int tableIndexOnStack)
void setFieldOnTable (struct lua_State *state, string key, string value, int tableIndexOnStack)
void setFieldOnTable (struct lua_State *state, const char *key, double value, int tableIndexOnStack)
void setFieldOnTable (struct lua_State *state, string key, double value, int tableIndexOnStack)
void writeFile (struct lua_State *state, std::string fileName, int stackIndex)
void openFileForRead (struct lua_State *state, std::string fileName)
void openFileForWrite (struct lua_State *state, std::string fileName)
void closeDefaultFile (struct lua_State *state)
void readFullFile (struct lua_State *state)
void writeToFile (struct lua_State *state, int stackIndex)
void printTable (struct lua_State *state, int stackIndex)
vector< string > extractStringSequence (struct lua_State *state, int stackIndex)

Static Private Member Functions

int convertStackIndex (struct lua_State *state, int stackIndex)


Detailed Description

LuaUtils - Collection of helper methods to perform common lua API operations. These methods perform a set of lua API calls and groups them in a convenient way.

Author:
Andrei Goldchleger


Member Function Documentation

void LuaUtils::closeDefaultFile struct lua_State *  state  )  [static]
 

int LuaUtils::convertStackIndex struct lua_State *  state,
int  stackIndex
[static, private]
 

vector< string > LuaUtils::extractStringSequence struct lua_State *  state,
int  stackIndex
[static]
 

int LuaUtils::getIntFromTable struct lua_State *  state,
const char *  key
[static]
 

std::string LuaUtils::getStringFromTable struct lua_State *  state,
const char *  key
[static]
 

Returns a string from a given lua table. Assumes that the table is on the top of the stack.

Parameters:
state - the lua_State on which to perform the operations
key - the name of the field to be retrieved

void LuaUtils::openFileForRead struct lua_State *  state,
std::string  fileName
[static]
 

void LuaUtils::openFileForWrite struct lua_State *  state,
std::string  fileName
[static]
 

void LuaUtils::printTable struct lua_State *  state,
int  stackIndex
[static]
 

void LuaUtils::readFullFile struct lua_State *  state  )  [static]
 

void LuaUtils::setFieldOnTable struct lua_State *  state,
string  key,
double  value,
int  tableIndexOnStack
[inline, static]
 

Sets a double on a specified lua table.

Parameters:
state - the lua_State on which to perform the operations
key - the name of the field to be set
value - the value to be set
tableIndexOnStack - the index of the table on stack

void LuaUtils::setFieldOnTable struct lua_State *  state,
const char *  key,
double  value,
int  tableIndexOnStack
[static]
 

Sets a double on a specified lua table.

Parameters:
state - the lua_State on which to perform the operations
key - the name of the field to be set
value - the value to be set
tableIndexOnStack - the index of the table on stack

void LuaUtils::setFieldOnTable struct lua_State *  state,
string  key,
string  value,
int  tableIndexOnStack
[inline, static]
 

Sets a string on a specified lua table.

Parameters:
state - the lua_State on which to perform the operations
key - the name of the field to be set
value - the value to be set
tableIndexOnStack - the index of the table on stack

void LuaUtils::setFieldOnTable struct lua_State *  state,
const char *  key,
const char *  value,
int  tableIndexOnStack
[static]
 

Sets a string on a specified lua table.

Parameters:
state - the lua_State on which to perform the operations
key - the name of the field to be set
value - the value to be set
tableIndexOnStack - the index of the table on stack

void LuaUtils::writeFile struct lua_State *  state,
std::string  fileName,
int  stackIndex
[static]
 

Write a value at a given position on the stack to a file

Parameters:
state - the lua_State on which to perform the operations
fileName - path to the file to be written
stackIndex - Position in the stack that contains the value to be written

void LuaUtils::writeToFile struct lua_State *  state,
int  stackIndex
[static]
 


The documentation for this class was generated from the following files:
Generated on Mon Sep 6 16:13:18 2004 by doxygen 1.3.3