Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/script_engine/src/lib/script_engine/script.h @ 8157

Last change on this file since 8157 was 8155, checked in by snellen, 18 years ago

this won't compile

File size: 1.5 KB
Line 
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
11class Script
12{
13  public:
14    Script();
15    ~Script();
16
17    bool loadFile(std::string& filename);
18    std::string getFileName(){return currentFile;}
19    bool executeFile();
20
21    lua_State* getLuaState() const{return luaState;}
22
23    bool selectFunction(std::string& functionName, int retCount);
24    bool executeFunction();
25    // push parameters for luafunction
26    bool  pushParam(int param, std::string& toFunction);
27    bool  pushParam(float param, std::string& toFunction);
28    bool  pushParam(double param, std::string& toFunction);
29    // get returned values the last return value in lua is the first in c. TODO: change order of return
30    int   getReturnedInt();
31    bool  getReturnedBool();
32    float getReturnedFloat();
33    void  getReturnedString(std::string& string);
34
35
36  private:
37
38    int reportError(int error);          //!< Get errormessage from the lua stack and print it.
39
40    lua_State*         luaState;         //!< The lua_State that the Script works on
41    std::string        currentFile;      //!< The file that is loaded in the script
42    std::string        currentFunction;  //!< The name of the current active function (the one that gets the pushed parameter)
43    int                argumentCount;    //!< Number of arguments for the current function
44    int                returnCount;      //!< Number of return values of the current function
45
46
47
48
49};
50#endif /* _SCRIPT_H */
Note: See TracBrowser for help on using the repository browser.