Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is an infinite yield? (as an orange thing in the output)

Asked by 8 years ago

Hello, I am trying to build a C++ compiler on ROBLOX, and before I write the actual coding, I write simple blocks of code that aren't part of the program just to test if everything is working ok. This is what I've done:

-- Script:
MainCompiler = require(script:WaitForChild("script.Parent.Parent.Parent.Parent.Workspace.MainCompiler.MainCompiler"))
script.Parent.MouseButton1Click:connect(function ()
    MainCompiler:printtext("Hello World")
end)
-- ModuleScript:
local M = {}
    function M:printtext(text)
        print(text)
    end
return M

When I debugged the code, I got this in orange: **14:19:05.086 - Infinite yield possible on 'Players.Firplius.PlayerGui.ScreenGui.Frame.TextButton.Script:WaitForChild("script.Parent.Parent.Parent.Parent.Workspace.MainCompiler.MainCompiler")'

What is an infinite yield, and what does it mean if I get blue, red, or orange as text in the output?

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Here is a little key 1st:-

Blue - script error and stack begin / end (you can click the link to go to the line) Example

Yellow - warnings these can also be coded Example

Red - Syntax errors in the code which stop its execution Example

Back to the problem

The WaitForChild has been changed so that you can now add a wait time for its second argument as previously it would have waited infinitely which uses extra memory ect making this waist resources.

When setting the time of the waitforchild the code will no longer hang infinitely avoiding the problems of an infinite hang. The yellow simply is there to warn you of this potential infinite hang, it will not effect any of your scripts which use this method but I would recommend that you add a time out if possible just for unforeseen circumstances.

Hope this helps.

Ad

Answer this question