hoa_script::ReadScriptDescriptor Class Reference

Represents a Lua file opened with read and execute permissions. More...

#include <script_read.h>

Inheritance diagram for hoa_script::ReadScriptDescriptor:

Inheritance graph
[legend]
Collaboration diagram for hoa_script::ReadScriptDescriptor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void DEBUG_PrintGlobals ()
 Prints out all global variable names to standard output.
void DEBUG_PrintLuaStack ()
 Prints out the contents of the Lua stack mechanism to standard output The elements are printed from stack top to stack bottom.
lua_State * GetLuaState ()
 Returns a pointer to the local lua state (use with caution).
virtual ~ReadScriptDescriptor ()
Table Operation Functions
After a table is opened, it becomes the active "space" that all of the data read operations operate on. You must always remember to close a table once you are finished reading data from it.

void CloseAllTables ()
 Closes any open tables and returns the user to the global scope.
void CloseTable ()
 Closes the most recently opened table.
uint32 GetTableSize ()
 Returns the number of elements stored in the most recently opened table.
uint32 GetTableSize (int32 table_name)
 Returns the number of elements stored in an un-opened table.
uint32 GetTableSize (const std::string &table_name)
 Returns the number of elements stored in an un-opened table.
void OpenTable (int32 table_name)
void OpenTable (const std::string &table_name)
 
Parameters:
table_name The name of the table to open

void ReadTableKeys (int32 table_name, std::vector< uint32 > &keys)
void ReadTableKeys (int32 table_name, std::vector< int32 > &keys)
void ReadTableKeys (int32 table_name, std::vector< std::string > &keys)
void ReadTableKeys (const std::string &table_name, std::vector< uint32 > &keys)
void ReadTableKeys (const std::string &table_name, std::vector< int32 > &keys)
void ReadTableKeys (const std::string &table_name, std::vector< std::string > &keys)
void ReadTableKeys (std::vector< uint32 > &keys)
void ReadTableKeys (std::vector< int32 > &keys)
void ReadTableKeys (std::vector< std::string > &keys)
 Fills a vector with all of the keys of a table.
File Access Functions
Note:
These are derived from ScriptDescriptor, refer to the comments for these methods in the header file for that class.


virtual void CloseFile ()
 Closes the script file and sets the _access_mode member to SCRIPT_CLOSED.
virtual bool OpenFile ()
 Opens the file named by the classes' _filename member.
virtual bool OpenFile (const std::string &file_name)
Existence Checking Functions
Methods which check if there exist certain data names and types in a script file

Parameters:
key The variable, table, or function name to check for
Returns:
True if the appropriate data type represented by that variable name was found.
Under normal circumstances, invoking any of these functions should not result in error messages being printed, even if the variable could not be found. There are some circumstances, however, where error messages may be added, such as when it is detected that a table is missing or the active scope is not appropriate for the function call.

Note:
The DoesVariableExist checks if is there is any data type, structure, or function referenced by the key name.


bool DoesBoolExist (int32 key)
bool DoesBoolExist (const std::string &key)
bool DoesFloatExist (int32 key)
bool DoesFloatExist (const std::string &key)
bool DoesFunctionExist (int32 key)
bool DoesFunctionExist (const std::string &key)
bool DoesIntExist (int32 key)
bool DoesIntExist (const std::string &key)
bool DoesStringExist (int32 key)
bool DoesStringExist (const std::string &key)
bool DoesTableExist (int32 key)
bool DoesTableExist (const std::string &key)
bool DoesUIntExist (int32 key)
bool DoesUIntExist (const std::string &key)
bool DoesVariableExist (int32 key)
bool DoesVariableExist (const std::string &key)
Variable Read Functions
These functions grab a basic data type from the Lua file and return its value.

Parameters:
key The name or numeric id of the Lua variable to access.
Returns:
The value of the variable requested.
Note:
The integer keys are only valid for variables stored in a table, not for global variables.
These functions call the template _ReadData() functions with a default return value.

bool ReadBool (int32 key)
bool ReadBool (const std::string &key)
float ReadFloat (int32 key)
float ReadFloat (const std::string &key)
int32 ReadInt (int32 key)
int32 ReadInt (const std::string &key)
std::string ReadString (int32 key)
std::string ReadString (const std::string &key)
uint32 ReadUInt (int32 key)
uint32 ReadUInt (const std::string &key)
hoa_utils::ustring ReadUString (int32 key)
hoa_utils::ustring ReadUString (const std::string &key)
Vector Read Functions
These functions fill a vector with members of a table read from the Lua file.

Parameters:
key The name of the table to use to fill the vector.
vect A reference to the vector of elements to fill.
The table that these functions attempt to access is assumed to be closed. If the table is open prior to calling these functions, they will not operate properly. All of these functions call the template _ReadDataVector() functions to perform their operations.

Note:
The integer keys are only valid for tables that are elements of a parent table. They can not be used to access tables in the global space.


void ReadBoolVector (int32 key, std::vector< bool > &vect)
void ReadBoolVector (const std::string &key, std::vector< bool > &vect)
void ReadFloatVector (int32 key, std::vector< float > &vect)
void ReadFloatVector (const std::string &key, std::vector< float > &vect)
void ReadIntVector (int32 key, std::vector< int32 > &vect)
void ReadIntVector (const std::string &key, std::vector< int32 > &vect)
void ReadStringVector (int32 key, std::vector< std::string > &vect)
void ReadStringVector (const std::string &key, std::vector< std::string > &vect)
void ReadUIntVector (int32 key, std::vector< uint32 > &vect)
void ReadUIntVector (const std::string &key, std::vector< uint32 > &vect)
void ReadUStringVector (int32 key, std::vector< hoa_utils::ustring > &vect)
void ReadUStringVector (const std::string &key, std::vector< hoa_utils::ustring > &vect)
Function Pointer Read Functions
Parameters:
key The name of the function if it is contained in the global space, or the key if the function is embedded in a table.
Returns:
A luabind::object class object, which can be used to call the function. It effectively serves as a function pointer.


luabind::object ReadFunctionPointer (int32 key)
 
Note:
The calling function may not be contained within the global space for an integer key.

luabind::object ReadFunctionPointer (const std::string &key)

Protected Member Functions

Data Existence Check Functions
These functions are called by the public DoesTYPEExist functions of this class.

Parameters:
key The name or numeric id of the Lua data to check.
type The correct type that the data should check out to be (uses the Lua type constants)
Returns:
True if data of the corresponding key and type is found.
Note:
The integer keys are only valid for variables stored in a table, not for global variables.


bool _CheckDataType (int32 type, luabind::object &obj_check)
 A helper function for the _DoesDataExist functions that performs the data type check.
bool _DoesDataExist (int32 key, int32 type)
bool _DoesDataExist (const std::string &key, int32 type)
Variable Read Templates
These template functions are called by the public ReadTYPE functions of this class.

Parameters:
key The name or numeric identifier of the Lua variable to access.
default_value The value for the function to return if an error occurs.
Returns:
The value of the variable requested.
Note:
Integer keys are only valid for variables stored in a table, not for global variables.


template<class T>
_ReadData (int32 key, T default_value)
template<class T>
_ReadData (const std::string &key, T default_value)
Vector Read Templates
These template functions are called by the public ReadTYPEVector functions of this class.

Parameters:
key The name or numeric identifier of the Lua variable to access.
vect A reference to the vector where the read variables should be stored
Note:
Integer keys are only valid for variables stored in a table, not for global variables.


template<class T>
void _ReadDataVector (int32 key, std::vector< T > &vect)
template<class T>
void _ReadDataVector (const std::string &key, std::vector< T > &vect)
template<class T>
void _ReadDataVectorHelper (std::vector< T > &vect)
 This template method is a helper function for the other two.
Table Key Template
This template function fills a vector with all of the keys contained by the table

Parameters:
vect A reference to the vector where the keys should be stored
Note:
This function will fail for any table that has multiple key types (ie, contains both integer and string keys).


template<class T>
void _ReadTableKeys (std::vector< T > &keys)

Protected Attributes

lua_State * _lstack
 The Lua stack, which handles all data sharing between C++ and Lua.

Friends

class GameScript

Detailed Description

Represents a Lua file opened with read and execute permissions.

****************************************************************************

This is the most commonly used of the script descriptor classes. This class allows you to read simple data types, open and close tables contained within the file, check for the existence of specific variable names and identifiers, retrieve pointers to Lua functions which can then be executed, and more.

The most important concept for understanding how to use this class is that of table scope. A scope is the portion of the Lua file that many of the data read operations in this class operate on. For example, the global scope contains all global variables, functions, and tables. There is a unique scope inherit inside each table in the file (including the tables of tables). When you invoke a read operation, ReadInt() for example, it attempts to read an integer in the current scope. If you have no tables open, it will look in the global space. Otherwise, it will look in the most recently opened table. Thus, it is extremely important that you know which scope is "active", and to know when to open and close tables to be in the correct scope.

Note:
With the exception of the open/close file functions, all methods of this class assume that the file is open and do not check otherwise. If you try to invoke these functions with an unopened file, you will generate a segmentation fault.
Bug:
Fix GetTableSize methods to account for tables with a 0th element

Definition at line 70 of file script_read.h.


Constructor & Destructor Documentation

hoa_script::ReadScriptDescriptor::~ReadScriptDescriptor (  )  [virtual]

Definition at line 30 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_access_mode, hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_filename, hoa_script::ScriptDescriptor::_open_tables, CloseFile(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_script::SCRIPT_CLOSED, and hoa_script::SCRIPT_DEBUG.

Here is the call graph for this function:


Member Function Documentation

bool hoa_script::ReadScriptDescriptor::_CheckDataType ( int32  type,
luabind::object &  obj_check 
) [protected]

A helper function for the _DoesDataExist functions that performs the data type check.

Parameters:
type An integer type to compare with the type of the object
obj_check The Luabind object whose type to compare to the integer type
Returns:
True if the two types are equivalent

Definition at line 157 of file script_read.cpp.

References hoa_script::private_script::FLOAT_TYPE, hoa_script::private_script::INTEGER_TYPE, and hoa_script::private_script::UINTEGER_TYPE.

Referenced by _DoesDataExist().

bool hoa_script::ReadScriptDescriptor::_DoesDataExist ( int32  key,
int32  type 
) [protected]

Definition at line 137 of file script_read.cpp.

References _CheckDataType(), hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_open_tables, and hoa_script::private_script::STACK_TOP.

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::_DoesDataExist ( const std::string &  key,
int32  type 
) [protected]

Referenced by DoesBoolExist(), DoesFloatExist(), DoesFunctionExist(), DoesIntExist(), DoesStringExist(), DoesTableExist(), DoesUIntExist(), and DoesVariableExist().

template<class T>
T hoa_script::ReadScriptDescriptor::_ReadData ( int32  key,
default_value 
) [protected]

Definition at line 451 of file script_read.h.

References hoa_script::ScriptDescriptor::_error_messages, _lstack, hoa_script::ScriptDescriptor::_open_tables, and hoa_script::private_script::STACK_TOP.

template<class T>
T hoa_script::ReadScriptDescriptor::_ReadData ( const std::string &  key,
default_value 
) [protected]

Definition at line 409 of file script_read.h.

References hoa_script::ScriptDescriptor::_error_messages, _lstack, hoa_script::ScriptDescriptor::_open_tables, and hoa_script::private_script::STACK_TOP.

template<class T>
void hoa_script::ReadScriptDescriptor::_ReadDataVector ( int32  key,
std::vector< T > &  vect 
) [protected]

Definition at line 488 of file script_read.h.

References hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_open_tables, _ReadDataVectorHelper(), CloseTable(), and OpenTable().

Here is the call graph for this function:

template<class T>
void hoa_script::ReadScriptDescriptor::_ReadDataVector ( const std::string &  key,
std::vector< T > &  vect 
) [protected]

Definition at line 479 of file script_read.h.

References _ReadDataVectorHelper(), CloseTable(), and OpenTable().

Here is the call graph for this function:

template<class T>
void hoa_script::ReadScriptDescriptor::_ReadDataVectorHelper ( std::vector< T > &  vect  )  [protected]

This template method is a helper function for the other two.

Definition at line 503 of file script_read.h.

References hoa_script::ScriptDescriptor::_error_messages, _lstack, hoa_script::private_script::STACK_TOP, and hoa_script::private_script::TABLE_END.

Referenced by _ReadDataVector().

template<class T>
void hoa_script::ReadScriptDescriptor::_ReadTableKeys ( std::vector< T > &  keys  )  [protected]

Definition at line 524 of file script_read.h.

References hoa_script::ScriptDescriptor::_error_messages, _lstack, hoa_script::ScriptDescriptor::_open_tables, hoa_script::private_script::STACK_TOP, and hoa_script::private_script::TABLE_END.

Referenced by ReadTableKeys().

void hoa_script::ReadScriptDescriptor::CloseAllTables (  ) 

Closes any open tables and returns the user to the global scope.

Definition at line 339 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_open_tables, and CloseTable().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::CloseFile (  )  [virtual]

Closes the script file and sets the _access_mode member to SCRIPT_CLOSED.

Implements hoa_script::ScriptDescriptor.

Reimplemented in hoa_script::ModifyScriptDescriptor.

Definition at line 89 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_access_mode, hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_filename, hoa_script::ScriptDescriptor::_open_tables, hoa_script::GameScript::_RemoveOpenFile(), hoa_script::ScriptDescriptor::IsErrorDetected(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_script::SCRIPT_CLOSED, hoa_script::SCRIPT_DEBUG, and hoa_script::ScriptManager.

Referenced by hoa_boot::BootMode::_EndOpeningAnimation(), hoa_map::MapMode::_LoadTiles(), hoa_boot::BootMode::BootMode(), hoa_boot::CreditsScreen::CreditsScreen(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_input::GameInput::RestoreDefaultJoyButtons(), hoa_input::GameInput::RestoreDefaultKeys(), hoa_video::GameVideo::SingletonInitialize(), hoa_system::GameSystem::SingletonInitialize(), hoa_input::GameInput::SingletonInitialize(), hoa_global::GameGlobal::~GameGlobal(), hoa_map::MapMode::~MapMode(), and ~ReadScriptDescriptor().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::CloseTable (  ) 

Closes the most recently opened table.

Definition at line 327 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_error_messages, and hoa_script::ScriptDescriptor::_open_tables.

Referenced by hoa_global::GameGlobal::_LoadCharacter(), hoa_global::GameGlobal::_LoadEvents(), hoa_global::GameGlobal::_LoadInventory(), hoa_map::MapMode::_LoadTiles(), _ReadDataVector(), hoa_map::private_map::MapDialogue::AddText(), CloseAllTables(), GetTableSize(), hoa_global::GlobalArmor::GlobalArmor(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), hoa_global::GlobalWeapon::GlobalWeapon(), hoa_editor::Grid::LoadMap(), ReadTableKeys(), hoa_input::GameInput::RestoreDefaultJoyButtons(), hoa_input::GameInput::RestoreDefaultKeys(), hoa_video::GameVideo::SingletonInitialize(), hoa_system::GameSystem::SingletonInitialize(), hoa_input::GameInput::SingletonInitialize(), hoa_editor::Tileset::Tileset(), and hoa_global::GameGlobal::~GameGlobal().

void hoa_script::ReadScriptDescriptor::DEBUG_PrintGlobals (  ) 

Prints out all global variable names to standard output.

Definition at line 427 of file script_read.cpp.

void hoa_script::ReadScriptDescriptor::DEBUG_PrintLuaStack (  ) 

Prints out the contents of the Lua stack mechanism to standard output The elements are printed from stack top to stack bottom.

Definition at line 383 of file script_read.cpp.

bool hoa_script::ReadScriptDescriptor::DoesBoolExist ( int32  key  )  [inline]

Definition at line 108 of file script_read.h.

References _DoesDataExist().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesBoolExist ( const std::string &  key  )  [inline]

Definition at line 105 of file script_read.h.

References _DoesDataExist().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesFloatExist ( int32  key  )  [inline]

Definition at line 126 of file script_read.h.

References _DoesDataExist(), and hoa_script::private_script::FLOAT_TYPE.

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesFloatExist ( const std::string &  key  )  [inline]

Definition at line 123 of file script_read.h.

References _DoesDataExist(), and hoa_script::private_script::FLOAT_TYPE.

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesFunctionExist ( int32  key  )  [inline]

Definition at line 138 of file script_read.h.

References _DoesDataExist().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesFunctionExist ( const std::string &  key  )  [inline]

Definition at line 135 of file script_read.h.

References _DoesDataExist().

Referenced by hoa_global::GlobalItem::GlobalItem(), and hoa_global::GlobalSkill::GlobalSkill().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesIntExist ( int32  key  )  [inline]

Definition at line 114 of file script_read.h.

References _DoesDataExist(), and hoa_script::private_script::INTEGER_TYPE.

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesIntExist ( const std::string &  key  )  [inline]

Definition at line 111 of file script_read.h.

References _DoesDataExist(), and hoa_script::private_script::INTEGER_TYPE.

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesStringExist ( int32  key  )  [inline]

Definition at line 132 of file script_read.h.

References _DoesDataExist().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesStringExist ( const std::string &  key  )  [inline]

Definition at line 129 of file script_read.h.

References _DoesDataExist().

Referenced by hoa_global::GlobalSkill::GlobalSkill().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesTableExist ( int32  key  )  [inline]

Definition at line 144 of file script_read.h.

References _DoesDataExist().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesTableExist ( const std::string &  key  )  [inline]

Definition at line 141 of file script_read.h.

References _DoesDataExist().

Referenced by hoa_global::GlobalArmor::GlobalArmor(), hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), and hoa_global::GlobalWeapon::GlobalWeapon().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesUIntExist ( int32  key  )  [inline]

Definition at line 120 of file script_read.h.

References _DoesDataExist(), and hoa_script::private_script::UINTEGER_TYPE.

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesUIntExist ( const std::string &  key  )  [inline]

Definition at line 117 of file script_read.h.

References _DoesDataExist(), and hoa_script::private_script::UINTEGER_TYPE.

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesVariableExist ( int32  key  )  [inline]

Definition at line 102 of file script_read.h.

References _DoesDataExist().

Here is the call graph for this function:

bool hoa_script::ReadScriptDescriptor::DoesVariableExist ( const std::string &  key  )  [inline]

Definition at line 99 of file script_read.h.

References _DoesDataExist().

Here is the call graph for this function:

lua_State* hoa_script::ReadScriptDescriptor::GetLuaState (  )  [inline]

Returns a pointer to the local lua state (use with caution).

Definition at line 337 of file script_read.h.

References _lstack.

Referenced by hoa_map::MapMode::_Load(), hoa_global::GlobalCharacterGrowth::AcknowledgeGrowth(), hoa_global::GlobalCharacter::GlobalCharacter(), and hoa_map::private_map::EnemySprite::Load().

uint32 hoa_script::ReadScriptDescriptor::GetTableSize (  ) 

Returns the number of elements stored in the most recently opened table.

Definition at line 370 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_open_tables, and hoa_script::private_script::STACK_TOP.

Referenced by GetTableSize().

uint32 hoa_script::ReadScriptDescriptor::GetTableSize ( int32  table_name  ) 

Returns the number of elements stored in an un-opened table.

Parameters:
table_name The integer key of the (un-open) table to get the size of
Note:
This function will only work when there is at least one other table already open

Definition at line 358 of file script_read.cpp.

References CloseTable(), GetTableSize(), and OpenTable().

Here is the call graph for this function:

uint32 hoa_script::ReadScriptDescriptor::GetTableSize ( const std::string &  table_name  ) 

Returns the number of elements stored in an un-opened table.

Parameters:
table_name The name of the (un-open) table to get the size of

Referenced by hoa_map::MapMode::_Load(), hoa_map::MapMode::_LoadTiles(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_editor::Grid::LoadMap(), and hoa_editor::Tileset::Tileset().

bool hoa_script::ReadScriptDescriptor::OpenFile (  )  [virtual]

Opens the file named by the classes' _filename member.

Returns:
False on failure, true on success.

Implements hoa_script::ScriptDescriptor.

Reimplemented in hoa_script::ModifyScriptDescriptor.

Definition at line 76 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_filename, and hoa_script::SCRIPT_DEBUG.

virtual bool hoa_script::ReadScriptDescriptor::OpenFile ( const std::string &  file_name  )  [virtual]

Parameters:
file_name The name of the Lua file to be opened.
Returns:
False on failure or true on success.
Note:
This is the only function that uses explicit error checking. An error in this function call will not change the return value of the GetErrors() function.

Implements hoa_script::ScriptDescriptor.

Reimplemented in hoa_script::ModifyScriptDescriptor.

Referenced by hoa_boot::BootMode::_EndOpeningAnimation(), hoa_map::MapMode::_Load(), hoa_map::MapMode::_LoadTiles(), hoa_global::GlobalCharacterGrowth::AcknowledgeGrowth(), hoa_boot::BootMode::BootMode(), hoa_boot::CreditsScreen::CreditsScreen(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_map::private_map::EnemySprite::Load(), hoa_editor::Grid::LoadMap(), hoa_input::GameInput::RestoreDefaultJoyButtons(), hoa_input::GameInput::RestoreDefaultKeys(), hoa_video::GameVideo::SingletonInitialize(), hoa_system::GameSystem::SingletonInitialize(), hoa_input::GameInput::SingletonInitialize(), hoa_global::GameGlobal::SingletonInitialize(), and hoa_editor::Tileset::Tileset().

void hoa_script::ReadScriptDescriptor::OpenTable ( int32  table_name  ) 

Parameters:
table_name The integer key of the table to open
Note:
This function will only work when there is at least one other table already open

Definition at line 306 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_error_messages, hoa_script::ScriptDescriptor::_open_tables, hoa_utils::NumberToString(), and hoa_script::private_script::STACK_TOP.

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::OpenTable ( const std::string &  table_name  ) 

Parameters:
table_name The name of the table to open

Referenced by hoa_global::GameGlobal::_LoadCharacter(), hoa_global::GameGlobal::_LoadEvents(), hoa_global::GameGlobal::_LoadInventory(), hoa_map::MapMode::_LoadTiles(), _ReadDataVector(), hoa_map::private_map::MapDialogue::AddText(), GetTableSize(), hoa_global::GlobalArmor::GlobalArmor(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), hoa_global::GlobalWeapon::GlobalWeapon(), hoa_editor::Grid::LoadMap(), ReadTableKeys(), hoa_input::GameInput::RestoreDefaultJoyButtons(), hoa_input::GameInput::RestoreDefaultKeys(), hoa_video::GameVideo::SingletonInitialize(), hoa_system::GameSystem::SingletonInitialize(), hoa_input::GameInput::SingletonInitialize(), hoa_global::GameGlobal::SingletonInitialize(), and hoa_editor::Tileset::Tileset().

bool hoa_script::ReadScriptDescriptor::ReadBool ( int32  key  )  [inline]

Definition at line 160 of file script_read.h.

bool hoa_script::ReadScriptDescriptor::ReadBool ( const std::string &  key  )  [inline]

Definition at line 157 of file script_read.h.

Referenced by hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), and hoa_video::GameVideo::SingletonInitialize().

void hoa_script::ReadScriptDescriptor::ReadBoolVector ( int32  key,
std::vector< bool > &  vect 
) [inline]

Definition at line 210 of file script_read.h.

void hoa_script::ReadScriptDescriptor::ReadBoolVector ( const std::string &  key,
std::vector< bool > &  vect 
) [inline]

Definition at line 207 of file script_read.h.

float hoa_script::ReadScriptDescriptor::ReadFloat ( int32  key  )  [inline]

Definition at line 178 of file script_read.h.

float hoa_script::ReadScriptDescriptor::ReadFloat ( const std::string &  key  )  [inline]

Definition at line 175 of file script_read.h.

Referenced by hoa_global::GlobalAttackPoint::_LoadData(), hoa_boot::BootMode::BootMode(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), and hoa_system::GameSystem::SingletonInitialize().

void hoa_script::ReadScriptDescriptor::ReadFloatVector ( int32  key,
std::vector< float > &  vect 
) [inline]

Definition at line 228 of file script_read.h.

void hoa_script::ReadScriptDescriptor::ReadFloatVector ( const std::string &  key,
std::vector< float > &  vect 
) [inline]

Definition at line 225 of file script_read.h.

object hoa_script::ReadScriptDescriptor::ReadFunctionPointer ( int32  key  ) 

Note:
The calling function may not be contained within the global space for an integer key.

Definition at line 259 of file script_read.cpp.

References hoa_script::ScriptDescriptor::_error_messages, and hoa_script::private_script::STACK_TOP.

luabind::object hoa_script::ReadScriptDescriptor::ReadFunctionPointer ( const std::string &  key  ) 

Referenced by hoa_map::MapMode::_Load(), hoa_map::private_map::MapDialogue::AddText(), hoa_global::GlobalItem::GlobalItem(), and hoa_global::GlobalSkill::GlobalSkill().

int32 hoa_script::ReadScriptDescriptor::ReadInt ( int32  key  )  [inline]

Definition at line 166 of file script_read.h.

int32 hoa_script::ReadScriptDescriptor::ReadInt ( const std::string &  key  )  [inline]

Definition at line 163 of file script_read.h.

Referenced by hoa_boot::BootMode::_EndOpeningAnimation(), hoa_map::MapMode::_Load(), hoa_global::GlobalAttackPoint::_LoadData(), hoa_global::GameGlobal::_LoadEvents(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), hoa_editor::Grid::LoadMap(), hoa_input::GameInput::RestoreDefaultJoyButtons(), hoa_input::GameInput::RestoreDefaultKeys(), hoa_video::GameVideo::SingletonInitialize(), and hoa_input::GameInput::SingletonInitialize().

void hoa_script::ReadScriptDescriptor::ReadIntVector ( int32  key,
std::vector< int32 > &  vect 
) [inline]

Definition at line 216 of file script_read.h.

void hoa_script::ReadScriptDescriptor::ReadIntVector ( const std::string &  key,
std::vector< int32 > &  vect 
) [inline]

Definition at line 213 of file script_read.h.

Referenced by hoa_map::MapMode::_Load(), hoa_map::MapMode::_LoadTiles(), hoa_editor::Grid::LoadMap(), and hoa_editor::Tileset::Tileset().

std::string hoa_script::ReadScriptDescriptor::ReadString ( int32  key  )  [inline]

Definition at line 184 of file script_read.h.

std::string hoa_script::ReadScriptDescriptor::ReadString ( const std::string &  key  )  [inline]

Definition at line 181 of file script_read.h.

Referenced by hoa_map::MapMode::_Load(), hoa_global::GlobalAttackPoint::_LoadData(), hoa_boot::BootMode::BootMode(), hoa_boot::CreditsScreen::CreditsScreen(), hoa_global::GlobalArmor::GlobalArmor(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), hoa_global::GlobalWeapon::GlobalWeapon(), hoa_map::private_map::EnemySprite::Load(), and hoa_editor::Grid::LoadMap().

void hoa_script::ReadScriptDescriptor::ReadStringVector ( int32  key,
std::vector< std::string > &  vect 
) [inline]

Definition at line 234 of file script_read.h.

void hoa_script::ReadScriptDescriptor::ReadStringVector ( const std::string &  key,
std::vector< std::string > &  vect 
) [inline]

Definition at line 231 of file script_read.h.

Referenced by hoa_map::MapMode::_Load(), hoa_map::MapMode::_LoadTiles(), and hoa_boot::BootMode::BootMode().

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( int32  table_name,
std::vector< uint32 > &  keys 
) [inline]

Definition at line 331 of file script_read.h.

References _ReadTableKeys(), CloseTable(), and OpenTable().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( int32  table_name,
std::vector< int32 > &  keys 
) [inline]

Definition at line 328 of file script_read.h.

References _ReadTableKeys(), CloseTable(), and OpenTable().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( int32  table_name,
std::vector< std::string > &  keys 
) [inline]

Definition at line 325 of file script_read.h.

References _ReadTableKeys(), CloseTable(), and OpenTable().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( const std::string &  table_name,
std::vector< uint32 > &  keys 
) [inline]

Definition at line 322 of file script_read.h.

References _ReadTableKeys(), CloseTable(), and OpenTable().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( const std::string &  table_name,
std::vector< int32 > &  keys 
) [inline]

Definition at line 319 of file script_read.h.

References _ReadTableKeys(), CloseTable(), and OpenTable().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( const std::string &  table_name,
std::vector< std::string > &  keys 
) [inline]

Definition at line 316 of file script_read.h.

References _ReadTableKeys(), CloseTable(), and OpenTable().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( std::vector< uint32 > &  keys  )  [inline]

Definition at line 313 of file script_read.h.

References _ReadTableKeys().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( std::vector< int32 > &  keys  )  [inline]

Definition at line 310 of file script_read.h.

References _ReadTableKeys().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadTableKeys ( std::vector< std::string > &  keys  )  [inline]

Fills a vector with all of the keys of a table.

Parameters:
table_name The name of the table to open and retrieve the keys from
keys A reference to the vector where to store the table keys
The functions without a table_name argument will retrieve the keys for the most recently opened table. The keys vector will cleared before the function starts populating it with table keys, so make sure nothing important is contained in the keys vector before calling this function. If the keys vector is empty after the function was called, either an error occured or the table was empty.

Note:
These functions will only work successfully for tables that have the same data type for all their keys (ie, all string keys or all integer keys). A table with mixed key types (integers and strings for example) will not be processed successfully by these functions.

Definition at line 307 of file script_read.h.

References _ReadTableKeys().

Referenced by hoa_global::GameGlobal::_LoadEvents(), hoa_global::GameGlobal::_LoadInventory(), hoa_global::GlobalCharacter::GlobalCharacter(), and hoa_global::GlobalEnemy::GlobalEnemy().

Here is the call graph for this function:

uint32 hoa_script::ReadScriptDescriptor::ReadUInt ( int32  key  )  [inline]

Definition at line 172 of file script_read.h.

uint32 hoa_script::ReadScriptDescriptor::ReadUInt ( const std::string &  key  )  [inline]

Definition at line 169 of file script_read.h.

Referenced by hoa_global::GameGlobal::_LoadCharacter(), hoa_global::GameGlobal::_LoadInventory(), hoa_global::GlobalArmor::GlobalArmor(), hoa_global::GlobalCharacter::GlobalCharacter(), hoa_global::GlobalEnemy::GlobalEnemy(), hoa_global::GlobalItem::GlobalItem(), hoa_global::GlobalSkill::GlobalSkill(), hoa_global::GlobalWeapon::GlobalWeapon(), and hoa_editor::Tileset::Tileset().

void hoa_script::ReadScriptDescriptor::ReadUIntVector ( int32  key,
std::vector< uint32 > &  vect 
) [inline]

Definition at line 222 of file script_read.h.

void hoa_script::ReadScriptDescriptor::ReadUIntVector ( const std::string &  key,
std::vector< uint32 > &  vect 
) [inline]

Definition at line 219 of file script_read.h.

Referenced by hoa_global::GameGlobal::_LoadCharacter(), and hoa_map::MapMode::_LoadTiles().

hoa_utils::ustring hoa_script::ReadScriptDescriptor::ReadUString ( int32  key  )  [inline]

Definition at line 190 of file script_read.h.

References hoa_utils::MakeUnicodeString().

Here is the call graph for this function:

hoa_utils::ustring hoa_script::ReadScriptDescriptor::ReadUString ( const std::string &  key  )  [inline]

Definition at line 187 of file script_read.h.

References hoa_utils::MakeUnicodeString().

Here is the call graph for this function:

void hoa_script::ReadScriptDescriptor::ReadUStringVector ( int32  key,
std::vector< hoa_utils::ustring > &  vect 
) [inline]

Definition at line 240 of file script_read.h.

void hoa_script::ReadScriptDescriptor::ReadUStringVector ( const std::string &  key,
std::vector< hoa_utils::ustring > &  vect 
) [inline]

Definition at line 237 of file script_read.h.


Friends And Related Function Documentation

friend class GameScript [friend]

Reimplemented from hoa_script::ScriptDescriptor.

Reimplemented in hoa_script::ModifyScriptDescriptor.

Definition at line 71 of file script_read.h.


Member Data Documentation

lua_State* hoa_script::ReadScriptDescriptor::_lstack [protected]

The Lua stack, which handles all data sharing between C++ and Lua.

Definition at line 350 of file script_read.h.

Referenced by hoa_script::ModifyScriptDescriptor::_AddNewData(), hoa_script::ModifyScriptDescriptor::_ModifyData(), _ReadData(), _ReadDataVectorHelper(), _ReadTableKeys(), hoa_script::ModifyScriptDescriptor::CloseFile(), hoa_script::ModifyScriptDescriptor::CommitChanges(), GetLuaState(), and hoa_script::ModifyScriptDescriptor::OpenFile().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:15:48 2007 for Hero of Allacrost by  doxygen 1.5.1