#include <LUAScript.h>
Public Member Functions | |
| LUAScript (ScorchedContext *context) | |
| ~LUAScript () | |
| bool | loadFromFile (const std::string &filename, std::string &error) |
| void | addWeaponFunctions () |
| bool | functionExists (const std::string &functionName) |
| bool | startFunction (const std::string &functionName) |
| bool | endFunction (int argCount) |
| bool | addStringParameter (const std::string &str) |
| bool | addNumberParameter (fixed number) |
| bool | addBoolParameter (bool boolean) |
| bool | addVectorParameter (const FixedVector &vector) |
| bool | setGlobal (const std::string &name, fixed value) |
| ScorchedContext * | getContext () |
| void | setWeapon (Weapon *weapon) |
| Weapon * | getWeapon () |
Protected Attributes | |
| Weapon * | weapon_ |
| ScorchedContext * | context_ |
| lua_State * | L_ |
Definition at line 31 of file LUAScript.h.
| LUAScript::LUAScript | ( | ScorchedContext * | context | ) |
Definition at line 30 of file LUAScript.cpp.
References L_, lua_open, lua_pushlightuserdata(), lua_setglobal, luaopen_base(), luaopen_math(), luaopen_s3d(), luaopen_string(), and luaopen_table().
| LUAScript::~LUAScript | ( | ) |
| bool LUAScript::loadFromFile | ( | const std::string & | filename, | |
| std::string & | error | |||
| ) |
Definition at line 63 of file LUAScript.cpp.
References S3D::formatStringBuffer(), L_, lua_tostring, and luaL_dofile.
Referenced by LUAScriptHook::loadHook(), and WeaponScript::parseXML().
| void LUAScript::addWeaponFunctions | ( | ) |
Definition at line 58 of file LUAScript.cpp.
References L_, and luaopen_s3dweapon().
Referenced by WeaponScript::parseXML().
| bool LUAScript::functionExists | ( | const std::string & | functionName | ) |
Definition at line 85 of file LUAScript.cpp.
References L_, lua_getglobal, lua_isnil, and lua_pop.
Referenced by LUAScriptHook::loadHook().
| bool LUAScript::startFunction | ( | const std::string & | functionName | ) |
Definition at line 93 of file LUAScript.cpp.
References L_, lua_getglobal, and lua_isnil.
Referenced by LUAScriptHook::callHookInternal(), and WeaponScript::fireWeapon().
| bool LUAScript::endFunction | ( | int | argCount | ) |
Definition at line 99 of file LUAScript.cpp.
References S3D::formatStringBuffer(), L_, Logger::log(), lua_pcall(), and lua_tostring.
Referenced by LUAScriptHook::callHookInternal(), and WeaponScript::fireWeapon().
| bool LUAScript::addStringParameter | ( | const std::string & | str | ) |
Definition at line 111 of file LUAScript.cpp.
References L_, and lua_pushstring().
Referenced by LUAScriptHook::callHookInternal().
| bool LUAScript::addNumberParameter | ( | fixed | number | ) |
Definition at line 117 of file LUAScript.cpp.
References fixed::getInternal(), L_, and lua_pushnumber().
Referenced by LUAScriptHook::callHookInternal(), and WeaponScript::fireWeapon().
| bool LUAScript::addBoolParameter | ( | bool | boolean | ) |
Definition at line 123 of file LUAScript.cpp.
References L_, and lua_pushboolean().
Referenced by LUAScriptHook::callHookInternal().
| bool LUAScript::addVectorParameter | ( | const FixedVector & | vector | ) |
Definition at line 129 of file LUAScript.cpp.
References LUAUtil::addVectorToStack(), and L_.
Referenced by WeaponScript::fireWeapon().
| bool LUAScript::setGlobal | ( | const std::string & | name, | |
| fixed | value | |||
| ) |
Definition at line 78 of file LUAScript.cpp.
References fixed::getInternal(), L_, lua_pushnumber(), and lua_setglobal.
Referenced by WeaponScript::parseXML().
| ScorchedContext* LUAScript::getContext | ( | ) | [inline] |
Definition at line 52 of file LUAScript.h.
References context_.
Referenced by s3d_explosion(), s3d_fire_weapon(), s3d_get_arenaheight(), s3d_get_arenawidth(), s3d_get_height(), s3d_get_landscapeheight(), s3d_get_landscapewidth(), s3d_get_option(), s3d_get_tank(), s3d_get_tanks(), s3d_laser(), s3d_napalm(), and s3d_random().
| void LUAScript::setWeapon | ( | Weapon * | weapon | ) | [inline] |
Definition at line 54 of file LUAScript.h.
References weapon_.
Referenced by WeaponScript::parseXML().
| Weapon* LUAScript::getWeapon | ( | ) | [inline] |
Definition at line 55 of file LUAScript.h.
References weapon_.
Referenced by s3d_explosion(), s3d_laser(), and s3d_napalm().
Weapon* LUAScript::weapon_ [protected] |
ScorchedContext* LUAScript::context_ [protected] |
lua_State* LUAScript::L_ [protected] |
Definition at line 60 of file LUAScript.h.
Referenced by addBoolParameter(), addNumberParameter(), addStringParameter(), addVectorParameter(), addWeaponFunctions(), endFunction(), functionExists(), loadFromFile(), LUAScript(), setGlobal(), startFunction(), and ~LUAScript().
1.5.3