VIVE

Posted by Caleb P, Posted on May 21, 2013

VIVE
Versatile Independent Variable Encoder
(rhymes with "hive")

An easy, reliable, and flexible way to convert tables to strings and vice-versa.

Supports keys of type "string" or "number"
Supports values of type "string", "number", "boolean", or "table".

What is VIVE?

Sweeping through a table of display objects

Posted by BeyondtheTech, Posted on March 25, 2013

Perhaps some of you know this already, but it wouldn't hurt to post, since it can help bring everyone up to speed.

Let's say you create a table of display objects, like gems, or missiles or enemy ships, and you want to sweep through the entire table to do something with them, like making them all explode or disappear instantly.

Insert the group object safely

Posted by max.srdk, Posted on May 16, 2012

I'm experienced actionscripter, and i've got stucked with the lack of really readable names of the tables in Lua. Well, it's not an issue to reconfigure the mind to avoid that mess. But, one sunny day, i found that i coud not get the the object by it's name inside the group. And that was a challendge.

I tried to find the solution digging out the local code samples, but all in vain. Then, i tried to find my own way to add the objects into the display list. Lots of experiments and traces, and that's it - quite simple as a brick.

1
2
3
--[[
add(targ,obj,name,msg)
where:

Simple Lua Table Save & Load

Posted by krystian6, Posted on April 5, 2012

Hi,

I'm not sure if anyone is going to use it, but I wanted to share this little piece of code.
Currently it is designed to work with Corona XML Parser.

What this code does is simply store lua table into an xml file and load it afterwards.

Preference Library - Save data to Files ( tables/numbers/strings/boolean )

Posted by Satheesh, Posted on March 27, 2012, Last updated April 6, 2013

GitHub URL: 
https://github.com/SatheeshJM/Lua-Preference-Library

This small useful module can be used to store and retrieve values across different app sessions.

You can save TABLES, NUMBERS, STRINGS or BOOLEANS.

FUNCTIONS

1
2
3
4
5
preference.save
preference.getValue
preference.getAllValues
preference.print
preference.printAll

USAGE AND EXAMPLES

1
2
3
4
5
6
7
8
9
10
11
12
13
local preference = require "preference"
 
--Store numbers
preference.save{a=1}
value = preference.getValue("a")
 
--Store strings
preference.save{b="1"}
value = preference.getValue("b")
 
--Store Boolean
preference.save{c=true}
value = preference.getValue("c")

classes.lua - A simple Class implementation in Lua for Object-Oriented Programming

Posted by Varen, Posted on December 4, 2011, Last updated December 6, 2011

GitHub URL: 
https://gist.github.com/1429475

What?

classes provides a simple solution to Object-Oriented Programming in Lua. It has the basic OOP features one might expect, such as inheritance, and covers up dealing with metatables and the like.

Why?

classes was developed because when I started working with Corona, I had only a basic knowledge of Lua. Working on big projects, in any language, can usually benefit from some OOP functionality. There are a few libraries out there that bring this to Lua. This is a simple, lightweight, ~100 line implementation.

How?

abc alphabet learner Tutorial using table View in ansca corona

Posted by Deepak Singh Rawat, Posted on September 19, 2011, Last updated December 6, 2011

GitHub URL: 
https://abc-lerner-for-kids.googlecode.com/files/Iphone%20Alphabet%20Reader%20For%20kids.zip

This tutorial is build using list view of corona sample.

For more information check my blog :-
www.anscacorona.blogspot.com

or

My youtube channel :-

www.youtube.com/user/iphonemaclover

thank you

Have fun with corona SDK

--xxxxxxxxxxxxxxx main.lua file xxxxxxxxxxxx

1
2
3
4
5
6
7
8
9
10
--import the table view library
local tableView = require("tableView")
 
--import the button events library
local ui = require("ui")
 
display.setStatusBar( display.HiddenStatusBar ) 
------
--initial values
local image

Tables in Lua: Dictionaries AND Arrays

Posted by jhocking, Posted on January 23, 2011, Last updated January 28, 2011

Most people understand how to use Lua tables like arrays in other programming languages. However, Lua tables can also be used like dictionaries (aka hash tables, aka associative arrays) which is a very powerful concept.

Compatibility: 
Corona 2.0

Shuffle/randomize Tables

Posted by Ludicrous Software, Posted on January 7, 2011

The following function implements the modern version of the Fisher-Yates shuffling algorithm:

1
2
3
4
5
6
7
8
9
10
function table.shuffle(t)
        math.randomseed(os.time())
        assert(t, "table.shuffle() expected a table, got nil")
        local iterations = #t
        local j
        for i = iterations, 2, -1 do
                j = math.random(i)
                t[i], t[j] = t[j], t[i]
        end
end

Sample usage (change the '60' to some other value for a larger/smaller table):

1
2
3
4
local myTable = {}
for i = 1, 60, 1 do
        myTable[i] = i
end

Compatibility: 
Corona 1.0

Table View Library

Posted by Gilbert, Posted on July 16, 2010, Last updated March 30, 2011

This library will allow you to create table views. Tables have rows of items and can scroll up and down.

Download: http://bitbucket.org/gilbert/table-view-library/src
Source files include tableView.lua, ui.lua, main.lua and png graphics. Source files include an assets folder with graphic source files. Graphic source files can be used to create custom backgrounds and buttons.

Compatibility: 
Corona 2.0