mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
Add metatable to libevent
This commit is contained in:
parent
ce33adaa9f
commit
8276f40c38
|
@ -238,6 +238,12 @@ local function TranslateEvent(raw_event)
|
|||
t["data"]=table.pack(raw_event,2)
|
||||
end
|
||||
|
||||
setmetatable(t,{__index=function(xt,xk)
|
||||
local xname=rawget(xt,"event")
|
||||
if(xname==nil) then xname="<unknown>" end
|
||||
error("Event " .. xname .. " does not have member:" .. xk)
|
||||
end})
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user