promise for dialogue
This commit is contained in:
1 parent
05f7ada1d6
commit
e13c623d4b
1 file changed
+5
-1
@@ -81,12 +81,16 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel
|
|||||||
})
|
})
|
||||||
SetNuiFocus(true, true)
|
SetNuiFocus(true, true)
|
||||||
|
|
||||||
|
|
||||||
|
local prom = promise.new()
|
||||||
local wrappedFunction = function(selected)
|
local wrappedFunction = function(selected)
|
||||||
SetNuiFocus(false, false)
|
SetNuiFocus(false, false)
|
||||||
Dialogue.Close(name)
|
Dialogue.Close(name)
|
||||||
onSelected(selected)
|
if onSelected then onSelected(selected) end
|
||||||
|
prom:resolve(selected)
|
||||||
end
|
end
|
||||||
promises[name] = wrappedFunction
|
promises[name] = wrappedFunction
|
||||||
|
return Citizen.Await(prom)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user