OpenGTA/lua_addon/lua_vm.h

49 lines
1.4 KiB
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();
2015-12-03 00:38:22 +00:00
void runString(const char*);
void runFile(const char*);
void callSimpleFunction(const char*);
void setCityView(OpenGTA::CityView &);
void setMap(OpenGTA::Map &);
int getGlobalInt(const char*);
2015-12-03 00:37:02 +00:00
float getGlobalFloat(const char*);
const char* getGlobalString(const char*);
2015-12-03 00:38:22 +00:00
bool getGlobalBool(const char*);
void setGlobalInt(const char*, int);
void setGlobalFloat(const char*, float);
void setGlobalString(const char*, const char*);
void setGlobalBool(const char*, bool);
void setInt(const char*, int);
int getInt(const char*);
void setFloat(const char*, float);
float getFloat(const char*);
void setString(const char*, const char*);
const char* getString(const char*);
void setBool(const char*, bool);
bool getBool(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