48,403
edits
No edit summary |
No edit summary |
||
| Line 312: | Line 312: | ||
--[==[Finds the script whose code matches the one provided. If it exists, it returns a {{lua|Script}} object representing the script. Otherwise, it returns {{lua|nil}}, unless <span class="n">paramForError</span> is given, in which case an error is generated. If <code class="n">paramForError</code> is {{lua|true}}, a generic error message mentioning the bad code is generated; otherwise <code class="n">paramForError</code> should be a string or number specifying the parameter that the code came from, and this parameter will be mentioned in the error message along with the bad code.]==] | --[==[Finds the script whose code matches the one provided. If it exists, it returns a {{lua|Script}} object representing the script. Otherwise, it returns {{lua|nil}}, unless <span class="n">paramForError</span> is given, in which case an error is generated. If <code class="n">paramForError</code> is {{lua|true}}, a generic error message mentioning the bad code is generated; otherwise <code class="n">paramForError</code> should be a string or number specifying the parameter that the code came from, and this parameter will be mentioned in the error message along with the bad code.]==] | ||
function export.getByCode(code, paramForError, disallowNil, useRequire) | function export.getByCode(code, paramForError, disallowNil, useRequire) | ||
if code == nil and not disallowNil then | if code == nil and not disallowNil then | ||
return nil | return nil | ||