Module ErrorHandler

Our own implementation of ErrorHandler.

Info:

  • Copyright: GrayWolf64
  • License: Apache License 2.0

Tables

_errorTitles List of available error titles to choose from.

Local Functions

getFuncParams (func) Uses debug lib to get a function's param names.
getDigit (n) Gets the digit count of a number.
printTabContent (t) Prints the values of a table.
removeNewLine (str) Removes the '\n' at the end of a string.
readLines (fileName, startLine, endLine) Reads the lines of a file.
Assert (exp, argIndex, paramWarn, titleNum, maxSrcLines, note, markData) A more friendly but advanced assert function to be used by devs.


Tables

_errorTitles
List of available error titles to choose from.

Fields:

  • type mismatch
  • name conflict

Local Functions

getFuncParams (func)
Uses debug lib to get a function's param names.

Parameters:

  • func function

Returns:

    table params
getDigit (n)
Gets the digit count of a number.

Parameters:

  • n number

Returns:

    number digits
printTabContent (t)
Prints the values of a table.

Parameters:

  • t number
removeNewLine (str)
Removes the '\n' at the end of a string.

Parameters:

  • str string to process

Returns:

    string withoutNewLine
readLines (fileName, startLine, endLine)
Reads the lines of a file.

Parameters:

  • fileName
  • startLine
  • endLine
Assert (exp, argIndex, paramWarn, titleNum, maxSrcLines, note, markData)
A more friendly but advanced assert function to be used by devs. If an assert fails, it will show users the source code about how things should work. Underlines and emphases are allowed.

Parameters:

  • exp The expression to assert
  • argIndex If given, the arg of that index of the defined function will be underlined
  • paramWarn If given, the param's underline will be followed with a message
  • titleNum A title index
  • maxSrcLines If given, limits the lines of src output
  • note If given, the note will be put below the src
  • markData If given, add some custom marks under a certain line

See also:

Usage:

    local markData = {{line = 1, startPos = 2, endPos = 5, sign = "*", msg = "message following the signs(marks)"}}
generated by LDoc 1.5.0 Last updated 2023-07-17 09:58:50