Skip to content

Instantly share code, notes, and snippets.

View nadar71's full-sized avatar
🏠
Working from home

Simone Mapelli nadar71

🏠
Working from home
View GitHub Profile
-- table library extensions
-- allows the table.copy function to return a shallow copy of a range of the table items
-- Example:
--local t={1,2,3,4,5,6,7,8,9,10}
--dump(table.copy(t,3,8))
--prints out 3,4,5,6,7,8
local table_copy = table.copy
table.copy = function( t, ... )
if (type(arg[1]) == "number" and (arg[2] == nil or type(arg[2]) == "number")) then
-- collision library
local collisionslib = {}
local categoryNames = {}
local categoryCounter = 1
local function newCategory( name )
categoryNames[ name ] = categoryCounter
categoryCounter = categoryCounter * 2
@nadar71
nadar71 / download.lua
Last active November 10, 2016 11:29 — forked from michael714/download.lua
-- download.lua by Michael Weingarden May 2014
local dropbox = require("dropboxModule")
local widget = require( "widget" )
-- Load the relevant LuaSocket modules (no additional files required for these)
local http = require("socket.http")
local ltn12 = require("ltn12")
_H = display.contentHeight
@nadar71
nadar71 / revmob.lua
Last active August 29, 2015 14:14 — forked from deanPGM/revmob.lua
-- the only code changed from the original is from lines 454 to 466
package.preload['json']=(function(...)local e=string
local a=math
local u=table
local i=error
local d=tonumber
local c=tostring
local s=type
local o=setmetatable
------------------------------------------------------------------------------------------------------------------------
--Convex Separator for Box2D Flash for Corona SDK
--The original class has been written by Antoan Angelov.
--This LUA port was done by Ragdog Studios SRL (http://www.ragdogstudios.com)
--It is designed to work with Erin Catto's Box2D physics library implementation in Corona SDK (http://www.coronalabs.com)
--Everybody can use this software for any purpose, under two restrictions:
--1. You cannot claim that you wrote this software.
--2. You cannot remove or alter this notice.
--How to use it:
--------------------------------------------------------------------------------
--[[
Pixels
A simple POC of "pixel-based" drawing in Corona SDK. Implements a simple queue-based flood fill algorithm.
--]]
--------------------------------------------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- 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
@nadar71
nadar71 / dropbox.lua
Last active August 29, 2015 14:14 — forked from erinlin/dropbox.lua
-- Project: Dropbox Module
-- Description: A module for accessing Dropbox from Lua/CoronaSDK using the Dropbox REST API. Module written
-- by F. E. Torkel, based off code by Michael Weingarden.
local lfs = require( "lfs" )
local json = require( "json" )
local M = {}
@nadar71
nadar71 / dice.lua
Last active August 29, 2015 14:16 — forked from coronarob/dice.lua
math.randomseed( os.time() )
local function rollDice( dicePattern )
-- Dice pattern 3d6+3k3
-- First number : number of dice
-- d : required string
-- Second number : sides to the dice
-- +/- : optional modifier
-- ^/k : optional string; '^' keeps the high values, 'k' keeps the low values
-- Third number : number of dice to keep, i.e. 4d6^3 keeps the best three numbers
local SpringEasing = {}
-- EASING
local inflectX, inflectY = 0.075, 0.2
local outflectX, outflectY = 1 - inflectX, 1 - inflectY
local decay = 12
local function springIn(progress)
return progress ^ 4