Debugging on the device

Is it possibile?

thx [import]uid: 10482 topic_id: 3163 reply_id: 303163[/import]

For quick and dirty debugging on the device, I wrote this code.

File trace.lua
[lua]-- A debugging display
– This updates the device display with trace messages
– Change text color for readibility depending on the screen colors

module(…, package.seeall)

local textObj
local myX = display.contentWidth*0.5
local myY = -10

local trace = function (msg)
myY = myY + 20 --move trace down by this delta amount
textObj = display.newText(tostring(msg), myX, myY, native.systemFont, 14);
textObj:setTextColor(255, 255, 255)
end
_G.Trace = trace[/lua]

File main.lua
[lua]local trace = require (“trace”)

display.setStatusBar(display.HiddenStatusBar)

Trace(“1st trace line”)

local g = display.newGroup()
local ball = display.newCircle(display.contentWidth*0.5, display.contentHeight*0.5, 100)
ball:setFillColor(255, 0, 0)
ball:setStrokeColor(255, 255, 255)
ball.strokeWidth = 1
g:insert(ball)

Trace(“2nd trace line”)

function tester()
Trace(“4th trace line”)
end
timer.performWithDelay( 1000, tester )

Trace(“3rd trace line”)[/lua] [import]uid: 23636 topic_id: 3163 reply_id: 28920[/import]