Skip to content

Instantly share code, notes, and snippets.

local widget = require( "widget" )
local myList
local myData = {}
myData[1] = { name="Fred", phone="555-555-1234" }
myData[2] = { name="Barney", phone="555-555-1235" }
myData[3] = { name="Wilma", phone="555-555-1236" }
myData[4] = { name="Betty", phone="555-555-1237" }
myData[5] = { name="Pebbles", phone="555-555-1238" }
myData[6] = { name="BamBam", phone="555-555-1239" }
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
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
-- 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 )
-- 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 )
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
--[[
Perspective v2.0.2
A library for easily and smoothly integrating a virtual camera into your game.
Based on modified version of the Dusk camera system.
v2.0.2 adds a more stable tracking system and re-implements scrollX and scrollY
--]]
local function fire()
local beam = {}
for i = 1, 20 do
--Have used circle, but if you use a blurry yellow glow, it would look more like a fire
beam[i] = display.newCircle(0,0,3.5) --display.newImage("glow4.png")--
beam[i].x, beam[i].y = math.random(100,200) , 500
-- fingerPaint Library for Corona SDK
-- Copyright (c) 2014 Jason Schroeder
-- http://www.jasonschroeder.com
-- http://www.twitter.com/schroederapps
--[[ Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is