Skip to content

Instantly share code, notes, and snippets.

Foxbyte

Block or report user

Report or block Foxbyte

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Foxbyte
Foxbyte / test.lua
Last active Aug 7, 2019
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
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
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
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
end
function getColumnWidth( numberOfColumns )
You can’t perform that action at this time.