Shared
a better way to print, so you can later look up and track where your codes at
lib.print
Debug
lib.print.debug(message, path, line)Parameters
- message:
any - path:
debug.getinfo(1, "Sl").short_src - line:
debug.getinfo(1, "Sl").currentline
Example
wrapper/print.lua
function debugPrint(parameter)
lib.print.debug(parameter)
endshared/main.lua
local retval = 'Hello Lenix'
debugPrint(retval, debug.getinfo(1, "Sl").short_src, debug.getinfo(1, "Sl").currentline)its highly recommended to use debug.getinfo on the debug mode
Return
boolean: true if printed successfullystring: a message
Conditions
- valid print type
- defined message field
- only the following aliases are allowed:
- error = err
- warning = warn
- info = inf
Notice
⚠️
path and line are static values "as is" (except you know what you are doing) and also not required to be passes, they help for debugging and track the location of the actual print, except the ERROR type, when you ignore them, you will be switching automatically to a returnal error that stops the execution of the rest of the code