lua: add EventInterest convenience constructor for declaring interest on events
This commit is contained in:

committed by
Julian Bouzas

parent
2cffd9177a
commit
d72f31e803
@@ -70,6 +70,11 @@ local function Constraint (spec)
|
|||||||
return debug.setmetatable(spec, { __name = "Constraint" })
|
return debug.setmetatable(spec, { __name = "Constraint" })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function EventInterest(spec)
|
||||||
|
spec.type = "event"
|
||||||
|
return WpObjectInterest_new(spec)
|
||||||
|
end
|
||||||
|
|
||||||
local function dump_table(t, indent)
|
local function dump_table(t, indent)
|
||||||
local indent_str = ""
|
local indent_str = ""
|
||||||
indent = indent or 1
|
indent = indent or 1
|
||||||
@@ -201,6 +206,7 @@ SANDBOX_EXPORT = {
|
|||||||
Interest = WpObjectInterest_new,
|
Interest = WpObjectInterest_new,
|
||||||
SessionItem = WpSessionItem_new,
|
SessionItem = WpSessionItem_new,
|
||||||
Constraint = Constraint,
|
Constraint = Constraint,
|
||||||
|
EventInterest = EventInterest,
|
||||||
Device = WpDevice_new,
|
Device = WpDevice_new,
|
||||||
SpaDevice = WpSpaDevice_new,
|
SpaDevice = WpSpaDevice_new,
|
||||||
Node = WpNode_new,
|
Node = WpNode_new,
|
||||||
|
@@ -22,8 +22,7 @@ local function check_results()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local common_interests = {
|
local common_interests = {
|
||||||
Interest {
|
EventInterest {
|
||||||
type = "event",
|
|
||||||
Constraint { "event.type", "=", "test-event" },
|
Constraint { "event.type", "=", "test-event" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user