Revision Difference
Global.FireProblem#561724
<function name="FireProblem" parent="Global" type="libraryfunc">
<description>Fires a Problem with the given Data.</description>⤶
<realm>Menu</realm>⤶
⤶
<realm>Menu</realm>⤶
<file line="91-L102">lua/menu/problems/problems.lua</file>
<args>⤶
<arg name="prob" type="table">The Problem table. See <page>Structures/Problem</page></arg>⤶
⤶
<description>⤶
⤶
Creates a problem from the given definition.⤶
⤶
<note>⤶
⤶
Existing problems with the same Id will be replaced / overridden.⤶
⤶
</note>⤶
⤶
</description>⤶
⤶
<args>⤶
<arg name="problem" type="Structures/Problem">⤶
⤶
The problem's definition.⤶
⤶
</arg>⤶
</args>
</function>⤶
⤶
<example>⤶
<description>Creating a custom Problem</description>⤶
<code>⤶
local problem = {⤶
["id"] = "Example",⤶
["text"] = "This is an Example Problem.",
["type"] = "addons",⤶
["fix"] = function()⤶
ClearProblem("Example")
print("Fixed Problem.")
end⤶
⤶
</function>⤶
⤶
<br/>⤶
⤶
---⤶
⤶
<br/>⤶
⤶
<example name = 'Unfixable Problem' >⤶
⤶
<description>⤶
⤶
Creating a problem that the user cannot fix.
⤶
</description>⤶
⤶
<code>⤶
⤶
local problem = {
text = 'There is a problem!' ,
type = 'addons' ,⤶
id = 'my-problem-1234'⤶
}⤶
⤶
FireProblem(problem)⤶
⤶
</code>⤶
⤶
<output>⤶
⤶
<image src = 'https://files.facepunch.com/wiki/files/b5608/8dc5c1882fa7c97.webp' />⤶
⤶
</output>⤶
⤶
</example>⤶
⤶
<br/>⤶
⤶
<example name = 'Fixable Problem' >⤶
⤶
<description>⤶
⤶
Creating a problem that can be fixed by the user.⤶
⤶
</description>⤶
⤶
<code>⤶
⤶
local function fixProblem ()⤶
ClearProblem('my-problem-1234')⤶
end⤶
⤶
local problem = {⤶
text = 'There is a problem!' ,⤶
type = 'addons' ,⤶
fix = fixProblem ,⤶
id = 'my-problem-1234'⤶
}
FireProblem(problem)
</code>
</example>⤶
</code>
⤶
<output>⤶
⤶
<image src = 'https://files.facepunch.com/wiki/files/b5608/8dc5c18b01414c6.webp' />⤶
⤶
</output>⤶
⤶
</example>⤶