Debian Codegraph @

3rdparty/toluapp/src/tests/tdirectivebind.c

raw
1 /*
2 ** Lua binding: tdirective
3 ** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:24.
4 */
5
6 #ifndef __cplusplus
7 #include "stdlib.h"
8 #endif
9 #include "string.h"
10
11 #include "tolua.h"
12
13 /* Exported function */
14 TOLUA_API int tolua_tdirective_open (lua_State* tolua_S);
15
16 #include "lualib.h"
17 #include "lauxlib.h"
18 int a;
19 extern int a;
20 int main (void)
21 {
22 lua_State* L = lua_open();
23 luaopen_base(L);
24 tolua_tdirective_open(L);
25 lua_dofile(L,"tdirective.lua");
26 lua_close(L);
27 return 0;
28 }
29
30 /* function to register type */
31 static void tolua_reg_types (lua_State* tolua_S)
32 {
33 }
34
35 /* get function: a */
36 static int tolua_get_a(lua_State* tolua_S)
37 {
38 tolua_pushnumber(tolua_S,(double)a);
39 return 1;
40 }
41
42 /* set function: a */
43 static int tolua_set_a(lua_State* tolua_S)
44 {
45 #ifndef TOLUA_RELEASE
46 tolua_Error tolua_err;
47 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
48 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
49 #endif
50 a = ((int) tolua_tonumber(tolua_S,2,0));
51 return 0;
52 }
53
54 /* Open function */
55 TOLUA_API int tolua_tdirective_open (lua_State* tolua_S)
56 {
57 tolua_open(tolua_S);
58 tolua_reg_types(tolua_S);
59 tolua_module(tolua_S,NULL,1);
60 tolua_beginmodule(tolua_S,NULL);
61 tolua_variable(tolua_S,"a",tolua_get_a,tolua_set_a);
62 {
63 a = 3;
64 }
65
66 { /* begin embedded lua code */
67 static unsigned char B[] = {
68 10, 65, 32, 61, 32, 52,32
69 };
70 lua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code");
71 } /* end of embedded lua code */
72
73
74 { /* begin embedded lua code */
75 static unsigned char B[] = {
76 10,102,117,110, 99,116,105,111,110, 32,102,117,110, 99, 32,
77 40, 41, 10,114,101,116,117,114,110, 32, 53, 10,101,110,100,
78 32
79 };
80 lua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code");
81 } /* end of embedded lua code */
82
83 tolua_endmodule(tolua_S);
84 return 1;
85 }