summaryrefslogtreecommitdiff
path: root/ThirdParty/toluapp/src/tests/tmodulebind.c
blob: 0175a46430d4fb58305ee4418139e568c4870e27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
** Lua binding: tmodule
** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:13.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua.h"

/* Exported function */
TOLUA_API int tolua_tmodule_open (lua_State* tolua_S);

#include "tmodule.h"

/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
}

/* get function: a */
static int tolua_get_A_a(lua_State* tolua_S)
{
 tolua_pushnumber(tolua_S,(double)a);
 return 1;
}

/* set function: a */
static int tolua_set_A_a(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  a = ((int)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: b */
static int tolua_get_B_b(lua_State* tolua_S)
{
 tolua_pushnumber(tolua_S,(double)b);
 return 1;
}

/* set function: b */
static int tolua_set_B_b(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  b = ((int)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: c */
static int tolua_get_C_c(lua_State* tolua_S)
{
 tolua_pushnumber(tolua_S,(double)c);
 return 1;
}

/* set function: c */
static int tolua_set_C_c(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  c = ((int)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* get function: d */
static int tolua_get_A_d(lua_State* tolua_S)
{
 tolua_pushnumber(tolua_S,(double)d);
 return 1;
}

/* set function: d */
static int tolua_set_A_d(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  d = ((int)  tolua_tonumber(tolua_S,2,0));
 return 0;
}

/* Open function */
TOLUA_API int tolua_tmodule_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
 tolua_module(tolua_S,"A",1);
 tolua_beginmodule(tolua_S,"A");
 tolua_variable(tolua_S,"a",tolua_get_A_a,tolua_set_A_a);
 tolua_module(tolua_S,"B",1);
 tolua_beginmodule(tolua_S,"B");
 tolua_variable(tolua_S,"b",tolua_get_B_b,tolua_set_B_b);
 tolua_module(tolua_S,"C",1);
 tolua_beginmodule(tolua_S,"C");
 tolua_variable(tolua_S,"c",tolua_get_C_c,tolua_set_C_c);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 tolua_module(tolua_S,"A",1);
 tolua_beginmodule(tolua_S,"A");
 tolua_variable(tolua_S,"d",tolua_get_A_d,tolua_set_A_d);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}