3rdparty/toluapp/src/tests/tarray.c
raw| 1 | #include "lualib.h" |
| 2 | #include "lauxlib.h" |
| 3 | |
| 4 | #include "tarray.h" |
| 5 | |
| 6 | |
| 7 | int a[10] = {1,2,3,4,5,6,7,8,9,10}; |
| 8 | Point p[10] = {{0,1},{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,8},{8,9},{9,10}}; |
| 9 | Point* pp[10]; |
| 10 | |
| 11 | int ma[10]; |
| 12 | Point mp[10]; |
| 13 | Point* mpp[10]; |
| 14 | |
| 15 | Array array; |
| 16 | Array* parray = &array; |
| 17 | |
| 18 | int main (void) |
| 19 | { |
| 20 | int tolua_tarray_open (lua_State*); |
| 21 | lua_State* L = lua_open(); |
| 22 | int i; |
| 23 | |
| 24 | for (i=0; i<10; ++i) |
| 25 | { |
| 26 | pp[i] = &p[i]; |
| 27 | |
| 28 | ma[i] = a[i]; |
| 29 | mp[i] = p[i]; |
| 30 | mpp[i] = pp[i]; |
| 31 | |
| 32 | array.a[i] = a[i]; |
| 33 | array.p[i] = p[i]; |
| 34 | array.pp[i] = pp[i]; |
| 35 | } |
| 36 | |
| 37 | luaopen_base(L); |
| 38 | tolua_tarray_open(L); |
| 39 | |
| 40 | lua_dofile(L,"tarray.lua"); |
| 41 | |
| 42 | lua_close(L); |
| 43 | return 0; |
| 44 | } |
| 45 |