-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathLua.hpp
143 lines (119 loc) · 2.99 KB
/
Lua.hpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/**
@file Lua.hpp
@brief Declares the Lua class.
*/
#pragma once
#include "Just A Morpher.hpp"
#include "Singleton.hpp"
namespace JustAMorpher
{
/**
@brief Lua functions.
*/
class Lua_ : public Singleton <Lua_>
{
private:
/**
@brief Update a unit's model
@param State The Lua state.
*/
static int __cdecl UpdateModel (void* State);
/**
@brief Set the display ID a unit.
@param State The Lua state.
*/
static int __cdecl SetDisplayID (void* State);
/**
@brief Get the display ID of a unit.
@param State The Lua state.
*/
static int __cdecl GetDisplayID (void* State);
/**
@brief Get the native display ID of a unit.
@param State The Lua state.
*/
static int __cdecl GetNativeDisplayID (void* State);
/**
@brief Set the display ID of a unit's mount.
@param State The Lua state.
*/
static int __cdecl SetMountDisplayID (void* State);
/**
@brief Get the display ID of a unit's mount.
@param State The Lua state.
*/
static int __cdecl GetMountDisplayID (void* State);
/**
@brief Set the scale of a unit.
@param State The Lua state.
*/
static int __cdecl SetScale (void* State);
/**
@brief Get the scale of a unit.
@param State The Lua state.
*/
static int __cdecl GetScale (void* State);
/**
@brief Set the display ID of a unit's item.
@param State The Lua state.
*/
static int __cdecl SetItemDisplayID (void* State);
/**
@brief Get the display ID of a unit's item.
@param State The Lua state.
*/
static int __cdecl GetItemDisplayID (void* State);
/**
@brief Register a Lua function.
@param Name The name of the function.
@param Function The function.
*/
void RegisterFunction (const std::string& Name, int (__cdecl* Function)(void*)) const;
/**
@brief Get the total number of arguments.
@param State The Lua state.
@return The total number of arguments.
*/
unsigned int GetArgumentCount (void* State) const;
/**
@brief Throw a Lua error.
@param State The Lua state.
@param The error string.
*/
void Error (void* State, const std::string& String) const;
/**
@brief Get a value from Lua's stack as a string.
@param State The Lua state.
@param Index The index of the argument.
*/
std::string ToString (void* State, int Index) const;
/**
@brief Get a value from Lua's stack as a number.
@param State The Lua state.
@param Index The index of the argument.
*/
double ToNumber (void* State, int Index) const;
/**
@brief Push a number onto Lua's stack.
@param State The Lua state.
@param Value The number.
*/
void PushNumber (void* State, double Value) const;
public:
/**
@brief Default constructor
*/
Lua_ ();
/**
@brief Execute a Lua string.
@param String The string.
@param Name The name of the string.
*/
void DoString (const std::string& String, const std::string& Name) const;
/**
@brief Register Lua functions.
*/
void RegisterFunctions () const;
};
}
#define Lua JustAMorpher::Lua_::Get()