Skip to content

Instantly share code, notes, and snippets.

@prafulliu
Created December 30, 2012 09:14
Show Gist options
  • Save prafulliu/4411747 to your computer and use it in GitHub Desktop.
Save prafulliu/4411747 to your computer and use it in GitHub Desktop.
Get the last element of a table. table.maxn()
GameConfig = {}
GameConfig.CnfCity=
{
[1] = {
name = [[testname]],
value = 1,
list = {
{100, 1, 2000, 100, 0, 3, 1, 0, },
{101, 3, 2001, 101, 4, 3, 1, 1, },
{102, 3, 2002, 100, 0, 3, 1, 0, },
{103, 4, 2004, 100, 0, 3, 1, 0, },
{104, 5, 2004, 100, 0, 3, 1, 0, },
{105, 6, 2004, 101, 11, 3, 1, 2, },
{106, 7, 2006, 102, 0, 4, 1, 0, },
{107, 8, 2007, 102, 0, 4, 1, 0, },
{108, 9, 2008, 103, 15, 4, 1, 3, },
},
},
}
print(GameConfig.CnfCity[1].fblist[table.maxn(GameConfig.CnfCity[1].list)][1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment