/corona-html5-console-plugin

A simple plugin for logging to the browser console window.

Primary LanguageLuaApache License 2.0Apache-2.0

logo Corona HTML5 Console Plugin

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.

Browser Tests

chrome ie firefox safari opera
pass untested pass pass untested

Windows browser unconfirmed.

Installation

  • 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")

API

Not much to it...

log

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!")

Demo

A Corona project can be found in the demo directory that can be compiled to an HTML5 build for testing.

Notes

  • You'll need your browsers "Developer Tools" open to view the console output.

©2018 C. Byerley (develephant)