Root/lua/examples/lua_calls_C5/test.lua

1package.cpath = "./?.so"
2require "wrap"
3--test1
4wrap.lib_a_f_1()
5--test2
6assert(6==wrap.lib_a_f_2(2,3))
7--test3
8assert(5==wrap.lib_a_f_3("hello"))
9--test4 : use userdata to pass structure
10t=wrap.point_new(3,6)
11assert(18 == mylib.lib_a_f_4(t))
12--test5, return userdata
13t=wrap.lib_a_f_5()
14assert(600 == wrap.lib_a_f_4(t))
15assert(wrap.point_geta(t) == 20)
16assert(wrap.point_getb(t) == 30)
17

Archive Download this file

Branches:
master



interactive