2010-12-12 17:08:36 +00:00
|
|
|
#ifndef LUA_SCRIPT_H
|
|
|
|
#define LUA_SCRIPT_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "string"
|
|
|
|
|
|
|
|
#include "lua.hpp"
|
|
|
|
|
|
|
|
class LuaScript
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-02-10 08:48:04 +00:00
|
|
|
LuaScript(lua_State* p_pState, const char* p_strFile);
|
2010-12-12 17:08:36 +00:00
|
|
|
|
|
|
|
~LuaScript(void);
|
|
|
|
|
|
|
|
bool FunctionExists(const char* p_strFuncName);
|
|
|
|
|
|
|
|
void RunFunction(const char* p_strFuncName);
|
|
|
|
|
|
|
|
double RunFunctionDouble(const char* p_strFuncName);
|
|
|
|
|
|
|
|
std::wstring RunFunctionString(const char* p_strFuncName);
|
|
|
|
|
|
|
|
lua_State* GetState() { return m_pState; }
|
|
|
|
|
|
|
|
bool IsInitialized() { return m_bInitialized; }
|
|
|
|
|
|
|
|
void BindVariable(const char* p_strName, void* p_pValue, const char* p_strTypeName);
|
|
|
|
|
2011-02-10 08:48:04 +00:00
|
|
|
void PushTable() { lua_rawgeti(m_pState, LUA_GLOBALSINDEX, m_iRef); }
|
2010-12-12 17:08:36 +00:00
|
|
|
|
|
|
|
static void ReportErrors(lua_State * L);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
lua_State* m_pState;
|
|
|
|
|
2011-02-10 08:48:04 +00:00
|
|
|
char* m_strFile;
|
|
|
|
int m_iRef;
|
2010-12-12 17:08:36 +00:00
|
|
|
|
|
|
|
bool m_bInitialized;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|