Skip to content

Instantly share code, notes, and snippets.

@coronarob
coronarob / activity_items.lua
Last active August 29, 2015 14:17
List of items for the activity popup
local items =
{
{ type = "image", value = { filename = "Icon.png", baseDir = system.ResourceDirectory, } },
{ type = "string", value = "Hello, World" },
{ type = "url", value = "http://www.coronalabs.com" },
}
@coronarob
coronarob / build.settings
Last active August 29, 2015 14:17
Activity popup build.settings
settings =
{
plugins =
{
["CoronaProvider.native.popup.activity"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { iphone=true, ["iphone-sim"]=true },
},
},
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
string username = string.Empty;
var boxedUsername = e.Properties.Get("username") as CoronaLabs.Corona.WinRT.CoronaBoxedString;
if (boxedUsername != null)
{
username = boxedUsername.ToString();
}
private void OnCoronaRuntimeLoaded(
object sender, CoronaLabs.Corona.WinRT.CoronaRuntimeEventArgs e)
{
// Keep a reference to the Corona runtime environment.
// It's needed so that your login window's results can be dispatched to Corona.
fCoronaRuntimeEnvironment = e.CoronaRuntimeEnvironment;
fCoronaRuntimeEnvironment.AddEventListener("requestingLogin", OnRequestingLogin);
}
fCoronaPanel.Runtime.Loaded += OnCoronaRuntimeLoaded;
fCoronaPanel.Runtime.Terminating += OnCoronaRuntimeExiting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using TextTutorial.Resources;
--
-- Abstract: Hello World sample app.
--
-- Version: 1.2
--
-- Sample code is MIT licensed
-- Copyright (C) 2014 Corona Labs Inc. All Rights Reserved.
--
-- Supports Graphics 2.0
------------------------------------------------------------
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 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" }