Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/script_engine/src/lib/script_engine/Script.h @ 8044

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

calling scriptfunctions from c++ works now (includeing adding parameters)

File size: 1.0 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    bool executeFile();
19
20    lua_State* getLuaState() const{return luaState;}
21
22    void selectFunction(std::string& functionName, int retCount);
23    void  executeFunction(); //return number of returned values
24    bool pushParam(int param, std::string& toFunction);//overload this function to add different types
25    bool pushParam(float param, std::string& toFunction);
26
27
28
29
30  private:
31
32    int reportError(int error);
33
34    lua_State*         luaState;         //!< The lua_State that the Script works on
35    std::string        currentFunction;  //!< The name of the current active function (the one that gets the pushed parameter)
36    int                argumentCount;    //!< Number of arguments for the current function
37    int                returnCount;      //!< Number of return values of the current function
38
39
40
41
42};
43#endif /* _SCRIPT_H */
Note: See TracBrowser for help on using the repository browser.