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
|
/*
** Lua binding: tdirective
** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:24.
*/
#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"
#include "tolua.h"
/* Exported function */
TOLUA_API int tolua_tdirective_open (lua_State* tolua_S);
#include "lualib.h"
#include "lauxlib.h"
int a;
extern int a;
int main (void)
{
lua_State* L = lua_open();
luaopen_base(L);
tolua_tdirective_open(L);
lua_dofile(L,"tdirective.lua");
lua_close(L);
return 0;
}
/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
}
/* get function: a */
static int tolua_get_a(lua_State* tolua_S)
{
tolua_pushnumber(tolua_S,(double)a);
return 1;
}
/* set function: a */
static int tolua_set_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;
}
/* Open function */
TOLUA_API int tolua_tdirective_open (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
tolua_module(tolua_S,NULL,1);
tolua_beginmodule(tolua_S,NULL);
tolua_variable(tolua_S,"a",tolua_get_a,tolua_set_a);
{
a = 3;
}
{ /* begin embedded lua code */
static unsigned char B[] = {
10, 65, 32, 61, 32, 52,32
};
lua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code");
} /* end of embedded lua code */
{ /* begin embedded lua code */
static unsigned char B[] = {
10,102,117,110, 99,116,105,111,110, 32,102,117,110, 99, 32,
40, 41, 10,114,101,116,117,114,110, 32, 53, 10,101,110,100,
32
};
lua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code");
} /* end of embedded lua code */
tolua_endmodule(tolua_S);
return 1;
}
|