Skip to content

Instantly share code, notes, and snippets.

Foxbyte / simple grid
Created Mar 10, 2014
A simple grid to create columns in your Corona SDK project.
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
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
Foxbyte / test.lua
Last active Aug 18, 2018
CORONA LUA CODE: Calculate distance between 2 points and sort points (longitude, latitude) by your 'GPS position'
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
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
You can’t perform that action at this time.