-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathScript.h
More file actions
41 lines (28 loc) · 789 Bytes
/
Script.h
File metadata and controls
41 lines (28 loc) · 789 Bytes
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
#ifndef CLASS_SCRIPT
#define CLASS_SCRIPT
#include <nctl/String.h>
#include <ncine/LuaStateManager.h>
struct lua_State;
class Sprite;
namespace nc = ncine;
/// The class representing a single Lua script
class Script
{
public:
Script();
explicit Script(const char *filename);
inline bool canRun() const { return canRun_; }
inline const nctl::String &name() const { return name_; }
inline void setName(const nctl::String &name) { name_ = name; }
inline const char *errorMsg() const { return errorMessage_.data(); }
bool load(const char *filename);
bool reload();
private:
bool canRun_;
nctl::String name_;
nctl::String errorMessage_;
nc::LuaStateManager luaState_;
bool run(const char *filename, const char *chunkName);
friend class ScriptAnimation;
};
#endif