Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/script/src/util/tolua_bind.cc @ 999

Last change on this file since 999 was 999, checked in by bknecht, 16 years ago

some changes with the script. Made it singleton plus the files were moved into the core.

File size: 4.0 KB
Line 
1/*
2** Lua binding: script
3** Generated automatically by tolua++-1.0.92 on Sat Apr  5 20:29:18 2008.
4*/
5
6#ifndef __cplusplus
7#include "stdlib.h"
8#endif
9#include "string.h"
10
11#include "tolua++.h"
12
13/* Exported function */
14TOLUA_API int  tolua_script_open (lua_State* tolua_S);
15
16#include "Script.h"
17
18/* function to release collected object via destructor */
19#ifdef __cplusplus
20
21static int tolua_collect_orxonox__Script (lua_State* tolua_S)
22{
23 orxonox::Script* self = (orxonox::Script*) tolua_tousertype(tolua_S,1,0);
24        Mtolua_delete(self);
25        return 0;
26}
27#endif
28
29
30/* function to register type */
31static void tolua_reg_types (lua_State* tolua_S)
32{
33 tolua_usertype(tolua_S,"orxonox::Script");
34}
35
36/* method: new of class  orxonox::Script */
37#ifndef TOLUA_DISABLE_tolua_script_orxonox_Script_new00
38static int tolua_script_orxonox_Script_new00(lua_State* tolua_S)
39{
40#ifndef TOLUA_RELEASE
41 tolua_Error tolua_err;
42 if (
43     !tolua_isusertable(tolua_S,1,"orxonox::Script",0,&tolua_err) ||
44     !tolua_isnoobj(tolua_S,2,&tolua_err)
45 )
46  goto tolua_lerror;
47 else
48#endif
49 {
50  {
51   orxonox::Script* tolua_ret = (orxonox::Script*)  Mtolua_new((orxonox::Script)());
52    tolua_pushusertype(tolua_S,(void*)tolua_ret,"orxonox::Script");
53  }
54 }
55 return 1;
56#ifndef TOLUA_RELEASE
57 tolua_lerror:
58 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
59 return 0;
60#endif
61}
62#endif //#ifndef TOLUA_DISABLE
63
64/* method: new_local of class  orxonox::Script */
65#ifndef TOLUA_DISABLE_tolua_script_orxonox_Script_new00_local
66static int tolua_script_orxonox_Script_new00_local(lua_State* tolua_S)
67{
68#ifndef TOLUA_RELEASE
69 tolua_Error tolua_err;
70 if (
71     !tolua_isusertable(tolua_S,1,"orxonox::Script",0,&tolua_err) ||
72     !tolua_isnoobj(tolua_S,2,&tolua_err)
73 )
74  goto tolua_lerror;
75 else
76#endif
77 {
78  {
79   orxonox::Script* tolua_ret = (orxonox::Script*)  Mtolua_new((orxonox::Script)());
80    tolua_pushusertype(tolua_S,(void*)tolua_ret,"orxonox::Script");
81    tolua_register_gc(tolua_S,lua_gettop(tolua_S));
82  }
83 }
84 return 1;
85#ifndef TOLUA_RELEASE
86 tolua_lerror:
87 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
88 return 0;
89#endif
90}
91#endif //#ifndef TOLUA_DISABLE
92
93/* method: luaPrint of class  orxonox::Script */
94#ifndef TOLUA_DISABLE_tolua_script_orxonox_Script_luaPrint00
95static int tolua_script_orxonox_Script_luaPrint00(lua_State* tolua_S)
96{
97#ifndef TOLUA_RELEASE
98 tolua_Error tolua_err;
99 if (
100     !tolua_isusertype(tolua_S,1,"orxonox::Script",0,&tolua_err) ||
101     !tolua_isstring(tolua_S,2,0,&tolua_err) ||
102     !tolua_isnoobj(tolua_S,3,&tolua_err)
103 )
104  goto tolua_lerror;
105 else
106#endif
107 {
108  orxonox::Script* self = (orxonox::Script*)  tolua_tousertype(tolua_S,1,0);
109  char* str = ((char*)  tolua_tostring(tolua_S,2,0));
110#ifndef TOLUA_RELEASE
111  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'luaPrint'",NULL);
112#endif
113  {
114   self->luaPrint(str);
115  }
116 }
117 return 0;
118#ifndef TOLUA_RELEASE
119 tolua_lerror:
120 tolua_error(tolua_S,"#ferror in function 'luaPrint'.",&tolua_err);
121 return 0;
122#endif
123}
124#endif //#ifndef TOLUA_DISABLE
125
126/* Open function */
127TOLUA_API int tolua_script_open (lua_State* tolua_S)
128{
129 tolua_open(tolua_S);
130 tolua_reg_types(tolua_S);
131 tolua_module(tolua_S,NULL,0);
132 tolua_beginmodule(tolua_S,NULL);
133  tolua_module(tolua_S,"orxonox",0);
134  tolua_beginmodule(tolua_S,"orxonox");
135   #ifdef __cplusplus
136   tolua_cclass(tolua_S,"Script","orxonox::Script","",tolua_collect_orxonox__Script);
137   #else
138   tolua_cclass(tolua_S,"Script","orxonox::Script","",NULL);
139   #endif
140   tolua_beginmodule(tolua_S,"Script");
141    tolua_function(tolua_S,"new",tolua_script_orxonox_Script_new00);
142    tolua_function(tolua_S,"new_local",tolua_script_orxonox_Script_new00_local);
143    tolua_function(tolua_S,".call",tolua_script_orxonox_Script_new00_local);
144    tolua_function(tolua_S,"luaPrint",tolua_script_orxonox_Script_luaPrint00);
145   tolua_endmodule(tolua_S);
146  tolua_endmodule(tolua_S);
147 tolua_endmodule(tolua_S);
148 return 1;
149}
150
151
152#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
153 TOLUA_API int luaopen_script (lua_State* tolua_S) {
154 return tolua_script_open(tolua_S);
155};
156#endif
157
Note: See TracBrowser for help on using the repository browser.