3 ---@diagnostic disable: redefined-local
4 package
.path
= arg
[0]:sub(0, -arg
[0]:match("([^/\\]*)$"):len() - 1) .. "?.lua;" .. package
.path
5 local test
= require("test")
6 local a
= require("liba")
7 test
.dir(getmetatable(a
.pid
))
8 local ctx
= a
.pid
.new()
10 test
.dir(getmetatable(ctx
))
11 assert(type(a
.pid
.kpid(ctx
, 10, 0.1, 1)) == "userdata")
12 assert(type(a
.pid
.run(ctx
, 1, 0)) == "number")
13 assert(type(a
.pid
.pos(ctx
, 1, 0)) == "number")
14 assert(type(a
.pid
.inc(ctx
, 1, 0)) == "number")
15 assert(type(a
.pid
.zero(ctx
)) == "userdata")
16 ctx
:kpid(3, 2, 1):zero()
17 assert(type(ctx
:run(1, 0)) == "number")
18 assert(type(ctx
:pos(1, 0)) == "number")
19 assert(type(ctx
:inc(1, 0)) == "number")
20 assert(type(ctx
.kp
) == "number")
21 assert(type(ctx
.ki
) == "number")
22 assert(type(ctx
.kd
) == "number")
23 assert(type(ctx
.summax
) == "number")
24 assert(type(ctx
.summin
) == "number")
25 assert(type(ctx
.sum
) == "number")
26 assert(type(ctx
.outmax
) == "number")
27 assert(type(ctx
.outmin
) == "number")
28 assert(type(ctx
.out
) == "number")
29 assert(type(ctx
.fdb
) == "number")
30 assert(type(ctx
.err
) == "number")
43 assert(ctx
.__newindex
)
45 ---@field __name string
46 ---@field __index table
47 ---@field __newindex table