Too Many & Too Few End Calls
Closed this issue · 4 comments
Im trying to create this exact stack however I getting an error saying:
Callback has too many calls to Iris.End()
or To Few calls to Iris.End()
I tried to follow the demo you have on the docs page and then diagnose by looking at your source but I dont know why this is an issue.
Iris.Init()
Iris:Connect(function()
Iris.Window({"MENU", [Iris.Args.Window.NoResize] = true}, {size = Vector2.new(100, 100)})
if Iris.Button({"Spawn"}).clicked() then
RemotesManager.Client:Get("SpawnPlayer"):SendToServer()
Iris.End()
end
Iris.End()
end)
Iris.Button doesnt require an end.
even so, I still end up with a too many end calls error
In the case that the button is clicked, Iris.End() is called twice, instead:
if Iris.Button({"Spawn"}).clicked() then
-- call server
end
Iris.End()
Iris.End in branching code should only happen when a branch uses break
, return
, continue
, etc.
there is another problem, though, sendToServer yields. If the yield lasts longer than an Iris cycle, The same error will pop up.
if Iris.Button({"Spawn"}).clicked() then
task.spawn(function()
-- call server
end)
end
Iris.End()
I'm going to keep this issue opened because I think the behavior when attempting to yield should be improved, and should have an intuitive error.
I'm going to keep this issue opened because I think the behavior when attempting to yield should be improved, and should have an intuitive error.
Ive made this change now: e7bedd3, closing the issue