Require (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens
Created page with "<onlyinclude>{{Method |name = Require |arguments = {{type|bool}} <var>condition</var>, {{type|string}} <var>description</var> |description = If <var>c..."
m Text replacement - "</SyntaxHighlight>" to "</syntaxhighlight>"
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
|name                = Require
|name                = Require
|arguments = {{type|bool}} <var>condition</var>, {{type|string}} <var>description</var>
|arguments = {{type|bool}} <var>condition</var>, {{type|string}} <var>description</var>
|description          = If <var>condition</var> is {{true}}, prints <samp>Require passed: </samp>, followed by <var>description</var>, to the output, in <span style="color: blue;">blue</span> text. Otherwise, prints <samp>Require failed. Test ended: </samp>, followed by <var>description</var>, to the output, in red text, and calls the [[Done (Method)|Done]] method of the {{type|instance=TestService}}.
|description          = If <var>condition</var> is {{true}}, prints <samp style="color: blue;">Require passed: </samp>, followed by <var>description</var>, to the output, in blue text. Otherwise, prints <samp style="color: red;">Require failed. Test ended: </samp>, followed by <var>description</var>, to the output, in red text, and calls the [[Done (Method)|Done]] method of the {{type|instance=TestService}}.
|object              = TestService
|object              = TestService
}}</onlyinclude>
}}</onlyinclude>
Line 8: Line 8:
==Example==
==Example==
This code would print <samp>Require passed: example</samp> to the output, in blue text.
This code would print <samp>Require passed: example</samp> to the output, in blue text.
<code lua>
<syntaxhighlight lang="lua">
game:GetService('TestService'):Require(false, "example")
game:GetService('TestService'):Require(false, "example")
</code>
</syntaxhighlight>


[[Category:Methods]]
[[Category:Methods]]

Latest revision as of 04:45, 27 April 2023

Require( bool condition, string description )
Returns nil
Description: If condition is true, prints Require passed: , followed by description, to the output, in blue text. Otherwise, prints Require failed. Test ended: , followed by description, to the output, in red text, and calls the Done method of the TestService.
Member of: TestService

Example

This code would print Require passed: example to the output, in blue text.

game:GetService('TestService'):Require(false, "example")