Debian Codegraph @

src/gengine/ScriptState.h

raw
1 #ifndef HEADER_SCRIPTSTATE_H
2 #define HEADER_SCRIPTSTATE_H
3
4 class Path;
5 class Scripter;
6
7 #include "NoCopy.h"
8
9 #include <string>
10
11 extern "C" {
12 #include "lua.h"
13 }
14
15 /**
16 * Independent script state.
17 */
18 class ScriptState : public NoCopy {
19 private:
20 lua_State *m_state;
21 int m_errorHandlerIndex;
22 private:
23 void prepareErrorHandler();
24 void insertErrorHandler(int index);
25 void callStack(int error, int params=0, int returns=0);
26 public:
27 ScriptState();
28 ~ScriptState();
29
30 void doFile(const Path &file);
31 void doString(const std::string &input);
32 bool callCommand(int funcRef, int param);
33 void unref(int funcRef);
34
35 void registerFunc(const char *name, lua_CFunction func);
36 void registerLeader(Scripter *leader);
37 };
38
39 #endif