LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
LuaScript Class Reference

A class to enable lua scripts to load various modules. More...

#include <luascript.h>

Public Member Functions

 LuaScript (std::string script)
 
void OpenScript (const std::string &script)
 
void Close ()
 Close the script.
 
lua_State * Get ()
 
std::string File () const
 Get the script filename.
 
bool Open () const
 Check if there's a script open.
 
template<class ReturnType >
auto CallFunction (std::string function, std::vector< LuaC::LuaParam * > args=std::vector< LuaC::LuaParam * >()) -> decltype(ReturnType::Retrieve(mL))
 
void CallFunction (std::string function, std::vector< LuaC::LuaParam * > args=std::vector< LuaC::LuaParam * >())
 

Detailed Description

A class to enable lua scripts to load various modules.

ModuleManager enables Lua scripts to import other necessary modules

Constructor & Destructor Documentation

LuaScript::LuaScript ( std::string  script)

Create the LuaScript instance and open a script

Parameters
scriptThe script to open

Member Function Documentation

template<class ReturnType >
auto LuaScript::CallFunction ( std::string  function,
std::vector< LuaC::LuaParam * >  args = std::vector<LuaC::LuaParam*>() 
) -> decltype(ReturnType::Retrieve(mL))
inline

Call a function on the Lua state and pass some arguments to it

Parameters
functionName of the function to be called
argsVector of arguments to be passed
lua_State * LuaScript::Get ( )

Get the lua_State pointer to use for calling functions/etc.

Returns
The lua_State pointer held by the LuaScript class
void LuaScript::OpenScript ( const std::string &  script)

Open the desired Lua script to be run as the entity's behavior script

Parameters
scriptThe script file to open

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