RConsole - JS Console In Roblox

RConsole

JavaScript Console In Roblox

For those of you who absolutely love the JavaScript console and can’t stand people who say print is better than console.log, I’ve recreated the console object in Luau. Enjoy!

Disclaimers
  1. AFAIK, there isn’t exactly a way to print to the output in the blue info text, so console.info() was not included.
  2. console.clear() doesn’t actually clear the console, but prints a bunch of newlines.

Setup:

  1. Open a new script in ServerScriptService.

  2. Require the module:

local console = require(6794533185)
  1. Use one of the methods listed below.

Methods:

console.assert(condition, errmsg)

  • condition: Type<ConditionalStatement> (conditional statement)
  • errmsg: Type<String> (error message to output if the condition is false)

console.clear()

console:count(label)

  • label: Type<String> (unique label for count)

console.error(thing)

  • thing: Type<Any> (error with output)

console.log(thing)

  • thing: Type<Any> (print output)

console.table(thing)

  • thing: Type<Array> (display a table/array as a dictionary)

console:time(label)

  • label: Type<String> (unique label for time)

console:timeEnd(label)

  • label: Type<String> (unique label for time)

console.stack()

console.warn(thing)

  • thing: Type<Any> (warn with output)

GitHub

Pull requests are appreciated!

Edit Log:

Open

4m - Fixed documentation
2m - Fixed Github Link
1m - Added license statement

RConsole is licensed under the MIT license.

3 Likes

Now that, my friend, is a good use of time right there. That will save me a few headaches, thanks R0bl0x!

1 Like

From the looks of it, this seems really cool. I’ll take a look at the source later. console.error is useless since it just takes one simple line of code to do the job. Since this is a module, it wastes memory calling the function rather than using the error function that is built into roblox. Same goes for console.log; they both serve no purpose rather than wasting needed space. I see the outcome you are going for but I rather not sacrifice performance so I can have code that uses JavaScript functions to log messages/errors.

1 Like

Well, it isn’t built for optimization. If you’re looking to squeeze the best performance out of your game, I would recommend that you do not use this as multiple methods (assert, error, log, warn) are just redefined functions.

However, if you like the console object and don’t care too much about performance, then I think you’ll enjoy using this.

4 Likes

… What actually is it? Any examples?

You haven’t described any of the documents, you should probably also use better parameter names thing means literally nothing at all. Just a few things to work on. I’d also recommend you make the GitHub link more well known, along with linking to the actual model.

What is there to describe… ? This is meant for those who are familiar with the JavaScript console object. And yes, thing is described.

It can be of any type, and it is the output that is printed.