Invalid function name: len = string.long(my_str) - The string-length operator is hash mark '#' (as in: #my_str), or use function ' string.len(my_str)' but trying to use unknown function ' string.long(my_str)' will successfully pass during the pre-compile of edit-save, yet it will hit "Script error" when that portion of the Lua script is executed.Invalid concatenation by "+" not "." operator: my_str = my_str + "z" - The concatenation operator is double-dot "." and trying to use a plus-sign "+" might pass during the pre-compile of edit-save but hit "Script error" when that portion of the Lua script is executed."xx" - The string named 'my_str' must not be nil when used inside a string concatenation operation. Invalid concatenation of empty string: my_str = my_str. However, some errors are more common than others: Clicking the error text displays a popup that includes the actual error message generated by Lua, which can be used in a search engine to find a thorough description of what the message means and common remedies, as well as a stack trace to help determine the part of the code that actually triggered the error. There can be many reasons why a Lua module triggers the message " Script error" when run in another page. Instead, it might be possible to use a lexical analysis tool, specifically for Lua script, to better detect and pinpoint misspelled variables or logic errors in Lua source code. Other pre-compiled, or semi-compiled, languages can pinpoint the line number, or code phrase, where a syntax error, or undefined variable name, has been detected however, that processing can require extra time to perform. Note: the saving of a working copy can be done to an offline text file, rather than saving each version into the module revisions. In general, make one small change at a time, do a run show-preview, and save after a few good changes to have a version to restore, in case terrible errors occur after numerous later changes. Also, unlike wp:templates which can be run interactively by edit-preview, the Lua script must be tested by show-preview (or run preview) of another page which uses a template which #invokes the Lua module being edited. Because Lua is a "semi-compiled" interpreted language, it does not prescreen for all common syntax errors, nor detect misspelled variables, which are only found at runtime when seeing the " Script error" message. This help-page, Help:Lua debugging, explains issues of writing Lua script and debugging the source code, to remove errors or improve performance. WP:Lua (talk) Help To do Resources Reference manual
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |