Console - An implementation of JavaScript's console object in Luau

Console


An implementation of the JS console object in Luau

Get it on GitHub Get it on Roblox


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.

Images

Thank you

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.

@maddjames28

4 Likes

There doesn’t seem to be a link to any model or rbxm file. Did you forgot to link/attach it?

Oh sorry, It seems for me that links are not working currently. I can ping you once the bug is fixed.

what is the advantage of this over using the default console? are there any extra commands?

3 Likes

There’s a lot extra features mentioned in the post. Did you even read it?

There’s still no link to this.

1 Like

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)

3 Likes

Just saying that there are a lot of features and giving 3 examples isn’t telling us how this is an advantage over the default console.

Not to mention that no one can download the model either.

1 Like

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.

1 Like

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.

Thanks for the feedback though!

I have updated the module! It now supports functions such as a count, table, and group.

The time function is now in ms instead of frames :grin:.

Soft errors now show up red in the console without stopping the main thread.

Update:

  • Fixed internal modules
  • Timers are now more accurate
  • Timers are now displayed in microseconds
  • You can print and warn tuples instead of just stand-alone strings
  • Bug fixes

what even is the use of this LOL
just use print?? os.time?? hello

does this have

console.log
console.warn
console.info
console.debug
console.trace
console.table
console.clear
console.count
console.countReset
console.assert
console.error

(how many of them this has)

I don’t think this really has a use, then again this was made 1-2 years ago soo :person_shrugging:

idk what is the point of this lol you tell me

it doesn’t have any of those it seems; ill be sure to add them

1 Like