-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathluahandler.hpp
More file actions
54 lines (43 loc) · 1.93 KB
/
luahandler.hpp
File metadata and controls
54 lines (43 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include <lua.hpp>
#include <string>
#define LUA_LOG "###LUA_LOG :"
class LuaHandler {
lua_State* lua;
public:
LuaHandler();
~LuaHandler();
bool openFile(const std::string& fileName) const;
bool getGlobalBoolean(const std::string& globalVariableName) const;
int getGlobalInteger(const std::string& globalVariableName) const;
float getGlobalNumber(const std::string& globalVariableName) const;
std::string getGlobalString(const std::string& globalVariableName) const;
bool getBoolFromTable(const std::string& key) const;
int getIntegerFromTable(int index) const;
int getIntegerFromTable(const std::string& key) const;
float getNumberFromTable(int index) const;
float getNumberFromTable(const std::string& key) const;
std::string getStringFromTable(int index) const;
std::string getStringFromTable(const std::string& key) const;
bool getTableFromTable(int index) const;
bool getTableFromTable(const std::string& key) const;
///Returns true or false if the top of the stack is a table.
bool isTopOfStackATable() const;
bool getFunction(const std::string& functionName) const;
int callFunctionFromStack(int parameters, int returns) const;
int getAndCallFunction(const std::string&, int returns) const;
void pushBoolean(bool value) const;
void pushInteger(int value) const;
void pushNumber(float value) const;
void pushString(const std::string& value) const;
bool popBoolean() const;
int popInteger() const;
float popNumber() const;
std::string popString() const;
bool loadTable(const std::string& tableName) const;
void popTable() const;
///Pop the top of the stack and return the stack top.
int popTop() const;
int getStackTop() const;
int getLength() const;
};