View simple grid
-- Screen size | |
local screenW, screenH, halfW, halfH = display.viewableContentWidth, display.viewableContentHeight, display.viewableContentWidth*0.5, display.viewableContentHeight*0.5 | |
-- Grid | |
numberOfColumns = 16 | |
columnWidth = math.floor( screenW / numberOfColumns ) | |
function getColumnPosition( columnNumber ) | |
return (columnNumber - 1) * columnWidth | |
end | |
function getColumnWidth( numberOfColumns ) |
View Corona SDK - update GPS
local currentLatitude = 0 | |
local currentLongitude = 0 | |
local updateGps = 5000 -- update Gps every X seconds | |
local locationHandler = function( event ) | |
-- On update, stop listening to GPS signal to avoid battery draining | |
Runtime:removeEventListener( "location", locationHandler ) | |
-- Check for error (user may have turned off Location Services) | |
if event.errorCode then |
View test.lua
function print_r ( t ) | |
local print_r_cache={} | |
local function sub_print_r(t,indent) | |
if (print_r_cache[tostring(t)]) then | |
print(indent.."*"..tostring(t)) | |
else | |
print_r_cache[tostring(t)]=true | |
if (type(t)=="table") then | |
for pos,val in pairs(t) do | |
if (type(val)=="table") then |