3 package
.path
= arg
[0]:sub(0, -arg
[0]:match("([^/\\]*)$"):len() - 1) .. "?.lua;" .. package
.path
4 local test
= require("test")
5 local a
= require("liba")
6 test
.dir(getmetatable(a
.pid_neuro
))
7 local ctx
= a
.pid_neuro
.new()
9 test
.dir(getmetatable(ctx
))
10 assert(type(a
.pid_neuro
.set_kpid(ctx
, 4, 3, 2, 1)) == "userdata")
11 assert(type(a
.pid_neuro
.set_wpid(ctx
, 3, 2, 1)) == "userdata")
12 assert(type(a
.pid_neuro
.run(ctx
, 1, 0)) == "number")
13 assert(type(a
.pid_neuro
.inc(ctx
, 1, 0)) == "number")
14 assert(type(a
.pid_neuro
.zero(ctx
)) == "userdata")
15 ctx
:set_kpid(4, 3, 2, 1):set_wpid(3, 2, 1):zero()
16 assert(type(ctx
:run(1, 0)) == "number")
17 assert(type(ctx
:inc(1, 0)) == "number")
18 assert(type(ctx
.k
) == "number")
19 assert(type(ctx
.kp
) == "number")
20 assert(type(ctx
.ki
) == "number")
21 assert(type(ctx
.kd
) == "number")
22 assert(type(ctx
.wp
) == "number")
23 assert(type(ctx
.wi
) == "number")
24 assert(type(ctx
.wd
) == "number")
25 assert(type(ctx
.outmax
) == "number")
26 assert(type(ctx
.outmin
) == "number")
27 assert(type(ctx
.out
) == "number")
28 assert(type(ctx
.fdb
) == "number")
29 assert(type(ctx
.err
) == "number")
30 assert(type(ctx
.ec
) == "number")
45 assert(ctx
.__newindex
)
47 ---@field __name string
48 ---@field __index table
49 ---@field __newindex table