Last change
on this file since 8093 was
8093,
checked in by snellen, 18 years ago
|
continued working on the scriptmanager
|
File size:
1.3 KB
|
Rev | Line | |
---|
[8075] | 1 | #ifndef _SCRIPT_H |
---|
| 2 | #define _SCRIPT_H |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | #include <string> |
---|
| 6 | #include "base_object.h" |
---|
| 7 | |
---|
| 8 | #include "luaincl.h" |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | class Script |
---|
| 12 | { |
---|
| 13 | public: |
---|
| 14 | Script(); |
---|
| 15 | ~Script(); |
---|
| 16 | |
---|
| 17 | bool loadFile(std::string& filename); |
---|
| 18 | bool executeFile(); |
---|
| 19 | |
---|
| 20 | lua_State* getLuaState() const{return luaState;} |
---|
| 21 | |
---|
| 22 | bool selectFunction(std::string& functionName, int retCount); |
---|
| 23 | bool executeFunction(); |
---|
| 24 | // push parameters for luafunction |
---|
[8093] | 25 | bool pushParam(int param, std::string& toFunction); |
---|
[8075] | 26 | bool pushParam(float param, std::string& toFunction); |
---|
| 27 | bool pushParam(double param, std::string& toFunction); |
---|
| 28 | // get returned values the last return value in lua is the first in c. |
---|
[8093] | 29 | int getReturnedInt(); |
---|
[8075] | 30 | bool getReturnedBool(); |
---|
| 31 | float getReturnedFloat(); |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | private: |
---|
| 35 | |
---|
| 36 | int reportError(int error); |
---|
| 37 | |
---|
| 38 | lua_State* luaState; //!< The lua_State that the Script works on |
---|
| 39 | std::string currentFile; //!< The file that is loaded in the script |
---|
| 40 | std::string currentFunction; //!< The name of the current active function (the one that gets the pushed parameter) |
---|
| 41 | int argumentCount; //!< Number of arguments for the current function |
---|
| 42 | int returnCount; //!< Number of return values of the current function |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | }; |
---|
| 48 | #endif /* _SCRIPT_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.