An implementation of the JS console object in Luau
Description
Console is an implementation of JavaScript’s console in Luau. It supports most functions such as console.log(), console.time(), and more. I created this package because there were really no good ways of outputting info and debugging, so I complied a bunch of functions into a package.
Console is not faster or anything, but a bit slower. Even though it’s slower, it’s only about 0.001 seconds slower than globals which should not display any visible performance difference.
I also didn’t like how Lua did their logging statements and the lack of features it offers. I’m also just familiar with JS and wanted to share this with all of you.
Why you should use it
The main reason why is organization. Lots of print, warn, and error statements can start to get messy. Another reason why is the ease of debug. You can easily time a piece of code, soft-error the thread, and way more. And the last, my favorite one: You can easily search for the word ‘console’. Forget where you put your logging statements? Use find and replace.
Advantages
Your code will look a lot cleaner and be more readable if you prefix logging statements with console.
If you have learned JS and are familiar with it, you will feel right at home.
Testing becomes a whole lot easier with single-line benchmarking.
Extra (and useful) features
I added a plethora of extra features, including easier to find stack trace, easy, quick and accurate benchmarking in microseconds, soft errors, and faster and better assert functions (we have a silent assert too!).
Documentation
For now, the documentation is inside the main module of the Console package.
Thank you for taking the time out of your day to read this topic. Please put any suggestions below and I can assure you that they will be taken into consideration.
I think a lot of the issue comes from the fact that without the source code + documentation, all anyone can really see is the image example. Even then, without seeing the code, it’s pretty tough to see how this will actually positively slot into a development experience (with the specifics of implementation, syntax, API, etc. being very important here - especially on the subject of potentially migrating existing projects)
Although this is neat and all, I just feel like its a overengineered version of just the regular print, and attempting to add features that were never necessary.
I would argue that as well, though as said it offers other features and helps keep things organized. I mostly made this for people who enjoy the JS console, including myself.