OpenGTA/lua_addon/lua_vm.h

37 lines
1007 B
C
Raw Normal View History

2015-12-03 00:37:02 +00:00
#ifndef OPENGTA_SCRIPT_VM_H
#define OPENGTA_SCRIPT_VM_H
#include "lua.hpp"
#include "Singleton.h"
#include "gl_cityview.h"
namespace OpenGTA {
namespace Script {
class LuaVM {
public:
LuaVM();
~LuaVM();
void runString(const char*);
void runFile(const char*);
void callSimpleFunction(const char*);
void setCityView(OpenGTA::CityView &);
2015-12-03 00:37:37 +00:00
void setMap(OpenGTA::Map &);
2015-12-03 00:37:02 +00:00
int getGlobalInt(const char*);
float getGlobalFloat(const char*);
const char* getGlobalString(const char*);
void setGlobalInt(const char*, int);
void setGlobalFloat(const char*, float);
void setGlobalString(const char*, const char*);
2015-12-03 00:37:37 +00:00
lua_State *getInternalState();
2015-12-03 00:37:02 +00:00
protected:
lua_State *L;
private:
bool _registered;
2015-12-03 00:37:37 +00:00
void prepare();
2015-12-03 00:37:02 +00:00
};
typedef Loki::SingletonHolder<LuaVM, Loki::CreateUsingNew, Loki::DefaultLifetime,
Loki::SingleThreaded> LuaVMHolder;
}
}
#endif