extensions/urho3d: Fix UnsubscribeFromEvent() so that uistack's SubscribeToStackEvent() works like it should
This commit is contained in:
parent
f089913ea6
commit
dd1e991602
@ -24,7 +24,6 @@ Buildat TODO
|
||||
- Normal block size should be definable to be a multiple of the voxel size
|
||||
- "Continuation voxels"
|
||||
- Support Cereal's shared pointer serialization in Lua
|
||||
- Something in uistack's global nil focus handling has broken
|
||||
- Automatically fetch and build and patch Urho3D when building buildat
|
||||
- Handle module load order properly in reloads (unload by popping from top,
|
||||
then reload everything until top)
|
||||
|
@ -216,7 +216,7 @@ function Safe.SubscribeToEvent(x, y, z)
|
||||
local object = x
|
||||
local sub_event_type = y
|
||||
local callback = z
|
||||
if callback == nil then
|
||||
if z == nil then
|
||||
object = nil
|
||||
sub_event_type = x
|
||||
callback = y
|
||||
@ -291,24 +291,8 @@ function Safe.SubscribeToEvent(x, y, z)
|
||||
return global_callback_name
|
||||
end
|
||||
|
||||
function Safe.UnsubscribeFromEvent(x, y)
|
||||
local object = x
|
||||
local sub_event_type = y
|
||||
if callback == nil then
|
||||
object = nil
|
||||
sub_event_type = x
|
||||
end
|
||||
if object then
|
||||
if not getmetatable(object) or not getmetatable(object).unsafe then
|
||||
error("SubscribeToEvent(): Object must be sandboxed")
|
||||
end
|
||||
end
|
||||
if object then
|
||||
local unsafe_object = getmetatable(object).unsafe
|
||||
UnsubscribeFromEvent(unsafe_object, sub_event_type)
|
||||
else
|
||||
UnsubscribeFromEvent(sub_event_type)
|
||||
end
|
||||
function Safe.UnsubscribeFromEvent(sub_event_type, cb_name)
|
||||
UnsubscribeFromEvent(sub_event_type, cb_name)
|
||||
-- TODO: Delete the generated global callback
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user