PTLib
Version 2.14.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
lua.h
Go to the documentation of this file.
1
/*
2
* lua.h
3
*
4
* Interface library for Lua interpreter
5
*
6
* Portable Tools Library
7
*
8
* Copyright (C) 2010 by Post Increment
9
*
10
* The contents of this file are subject to the Mozilla Public License
11
* Version 1.0 (the "License"); you may not use this file except in
12
* compliance with the License. You may obtain a copy of the License at
13
* http://www.mozilla.org/MPL/
14
*
15
* Software distributed under the License is distributed on an "AS IS"
16
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17
* the License for the specific language governing rights and limitations
18
* under the License.
19
*
20
* The Original Code is Portable Tools Library.
21
*
22
* The Initial Developer of the Original Code is Post Increment
23
*
24
* Contributor(s): Craig Southeren
25
* Robert Jongbloed
26
*
27
* $Revision: 29535 $
28
* $Author: rjongbloed $
29
* $Date: 2013-04-19 18:51:15 +1000 (Fri, 19 Apr 2013) $
30
*/
31
32
#ifndef PTLIB_LUA_H
33
#define PTLIB_LUA_H
34
35
#ifdef P_USE_PRAGMA
36
#pragma interface
37
#endif
38
39
#include <ptlib.h>
40
41
#if P_LUA
42
43
#include <
ptclib/script.h
>
44
#include <
ptclib/vartype.h
>
45
46
47
struct
lua_State;
48
49
51
60
class
PLua :
public
PScriptLanguage
61
{
62
PCLASSINFO
(PLua,
PScriptLanguage
)
63
public:
68
PLua();
69
71
~PLua();
73
78
virtual
bool
LoadFile(
79
const
PFilePath
& filename
80
);
81
84
virtual
bool
LoadText(
85
const
PString
& text
86
);
87
94
virtual
bool
Run(
95
const
char
* script = NULL
96
);
97
103
bool
CreateTable(
104
const
PString
& name,
105
const
PString
& metatable =
PString
::Empty()
106
);
107
113
bool
DeleteTable(
114
const
PString
& name,
115
bool
metaTable = false
116
);
117
118
124
virtual
bool
CreateComposite(
125
const
PString
& name
126
);
127
131
virtual
bool
GetVar(
132
const
PString
& name,
133
PVarType
& var
134
);
135
139
virtual
bool
SetVar(
140
const
PString
& name,
141
const
PVarType
& var
142
);
143
147
bool
GetBoolean(
148
const
PString
& name
149
);
150
154
bool
SetBoolean(
155
const
PString
& name,
156
bool
value
157
);
158
162
int
GetInteger(
163
const
PString
& name
164
);
165
169
bool
SetInteger(
170
const
PString
& name,
171
int
value
172
);
173
177
double
GetNumber(
178
const
PString
& name
179
);
180
184
bool
SetNumber(
185
const
PString
& name,
186
double
value
187
);
188
192
PString
GetString(
193
const
PString
& name
194
);
195
199
bool
SetString(
200
const
PString
& name,
201
const
char
* value
202
);
203
209
virtual
bool
ReleaseVariable(
210
const
PString
& name
211
);
212
239
bool
Call(
240
const
PString
& name,
241
const
char
* sigString = NULL,
242
...
243
);
244
bool
Call(
245
const
PString
& name,
246
Signature & signature
247
);
248
249
250
#define PDECLARE_LuaFunctionNotifier(cls, fn) PDECLARE_NOTIFIER2(PLua, cls, fn, PScriptLanguage::Signature &)
251
255
bool
SetFunction
(
256
const
PString
& name,
257
const
FunctionNotifier & func
258
);
260
261
protected
:
264
virtual
bool
OnLuaError(
int
code,
const
PString
& str =
PString::Empty
(),
int
pop = 0);
265
266
bool
ParseVariableName(
const
PString
& name,
PStringArray
& vars);
267
bool
InternalGetVariable(
const
PString
& name);
268
bool
InternalSetVariable(
const
PString
& name);
269
static
int
InternalCallback(lua_State * state);
270
int
InternalCallback();
271
272
lua_State * m_lua;
273
};
274
275
276
#endif // P_LUA
277
278
#endif // PTLIB_LUA_H
279
include
ptclib
lua.h
Generated on Fri Oct 10 2014 21:15:13 for PTLib by
1.8.3.1