Moses, Lua Tool for tables handling

Posted by roland.yonaba, Posted on July 30, 2012

GitHub URL: 
https://github.com/Yonaba/Moses

Moses is a Lua library which provides a set of utilities and helpers acting as shortcuts for common programming tasks on tables.
It extends the built-in Lua table library, making easier operations on arrays, lists, collections, objects, etc.
Moses was deeply inspired by the javascript library Underscore.js. It brings to Lua most of its functions and a lot more!

Using Moses is quite simple. Here is a short example:

1
2
local list = _.range(10)
=> {0,1,2,3,4,5,6,7,8,9,10}

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?

Adding Image and dynamic function from array

Posted by renvis@technowand, Posted on August 17, 2011

Simple code to load image and function to be associated to its event from a table. I hope you will find it useful.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--array with image name and function to be called on click event
local circles = {{"image1","fn1"}, {"image1","fn2"}, {"image1","fn3"}}
 
local x= -30
 
function fn1(self,event) 
  print("Function 1 Called")
end
 
function fn2(self,event) 
  print("Function 2 Called")
end
 
function fn3(self,event) 
  print("Function 3 Called")
end
 
for i=1, #circles do
        x = x +100
                images = display.newImage(circles[i][1]..".png")
                images.x = x 

Useful functions for Tables and Arrays

Posted by tjackiw, Posted on October 19, 2010, Last updated October 21, 2010

This module includes 5 very useful methods for working with Tables and Arrays:

1
2
3
4
5
keys(table) -- Returns the keys from the table
values(table) -- Returns the values from the table
include(table, value) -- Checks if the given value is included in the table
select(table, expression) -- Selects values from the table by the given expression
reject(table, expression) -- Rejects values from the table by the given expression

Usage:

1
2
local TableUtils = require("TableUtils")
local names      = { first = "Bob", second = "Joe", "Doe" }

Compatibility: 
Corona 1.0