Small Fixes
- onEvent now skips passing the custom event "other_event" - small error handling for xml lua errors
This commit is contained in:
@@ -153,6 +153,9 @@ return function(name, basalt)
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
sendEvent = function(self, event, ...)
|
sendEvent = function(self, event, ...)
|
||||||
|
if(event=="other_event")or(event=="custom_event")then
|
||||||
|
return eventSystem:sendEvent(event, self, ...)
|
||||||
|
end
|
||||||
return eventSystem:sendEvent(event, self, event, ...)
|
return eventSystem:sendEvent(event, self, event, ...)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,10 @@ local function registerFunctionEvent(self, data, event, scripts)
|
|||||||
else
|
else
|
||||||
event(self, function(...)
|
event(self, function(...)
|
||||||
eventEnv.event = {...}
|
eventEnv.event = {...}
|
||||||
load(data, nil, "t", eventEnv)()
|
local success, msg = pcall(load(data, nil, "t", eventEnv))
|
||||||
|
if not success then
|
||||||
|
error("XML Error: "..msg)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -194,7 +197,7 @@ return {
|
|||||||
end
|
end
|
||||||
|
|
||||||
local events = {"onClick", "onClickUp", "onHover", "onScroll", "onDrag", "onKey", "onKeyUp", "onRelease", "onChar", "onGetFocus", "onLoseFocus", "onResize", "onReposition", "onEvent", "onLeave"}
|
local events = {"onClick", "onClickUp", "onHover", "onScroll", "onDrag", "onKey", "onKeyUp", "onRelease", "onChar", "onGetFocus", "onLoseFocus", "onResize", "onReposition", "onEvent", "onLeave"}
|
||||||
for k,v in pairs(events)do
|
for _,v in pairs(events)do
|
||||||
if(xmlValue(v, data)~=nil)then
|
if(xmlValue(v, data)~=nil)then
|
||||||
registerFunctionEvent(self, xmlValue(v, data), self[v], scripts)
|
registerFunctionEvent(self, xmlValue(v, data), self[v], scripts)
|
||||||
end
|
end
|
||||||
@@ -588,7 +591,7 @@ return {
|
|||||||
setValuesByXMLData = function(self, data, scripts)
|
setValuesByXMLData = function(self, data, scripts)
|
||||||
if(xmlValue("start", data)~=nil)then
|
if(xmlValue("start", data)~=nil)then
|
||||||
local f = load(xmlValue("start", data), nil, "t", scripts.env)
|
local f = load(xmlValue("start", data), nil, "t", scripts.env)
|
||||||
self:start(f)
|
self:start(f)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user