A simple plugin for logging to the browser console window.
Yes, you can easily use the print
command while viewing the index-debug.html
file in your HTML5 build. But, this plugin allows you to output to the browser console using the normal index.html
build.
Pretty amazing stuff.
Windows browser unconfirmed.
- Download the Corona HTML5 Console Plugin respository.
- Move plugin/console.lua and plugin/console_js.js to the root of your HTML5 project.
- Require the plugin in your code where you need it.
local console = require("console")
Not much to it...
Log message data to the browser console window.
console.log(data)
The data
argument can be a Number, String, Boolean, or Table type.
Array table types are output as JS arrays. Regular table types are output as JS objects.
Example
local console = require("console")
console.log("Wow, something happened!")
A Corona project can be found in the demo directory that can be compiled to an HTML5 build for testing.
- You'll need your browsers "Developer Tools" open to view the console output.
©2018 C. Byerley (develephant)