Hello,
I’m currently developing an app for Spanish vocabulary revision, I’m a begginer to LUA, and beginner to programming altogether so any help would be greatly appreciated.
What I have is a list of Spanish words and their English translations and I’m trying to associate the two e.g. when you touch a Spanish word it turns into it’s English translation.
I know this has something to do with creating a table or array, but don’t know where to start!
If anybody could help me that would be fantastic.
Cheers,
Ryan [import]uid: 67571 topic_id: 12233 reply_id: 312233[/import]
You use Lua tables to create arrays.
This will create two Lua tables.
local spanish = {}
local english = {}
This will add words into the Spanish array and the corresponding English word into the same indexed point in the English array.
[code]
spanish[1] = “SPANISH HELLO”
english[1] = “ENGLISH HELLO”
spanish[2] = “SPANISH GOODBYE”
english[2] = “ENGLISH GOODBYE”
[/code] [import]uid: 26769 topic_id: 12233 reply_id: 44575[/import]
Thank you very much lordmooch, that was a great help! [import]uid: 67571 topic_id: 12233 reply_id: 44591[/import]
This article might help you out some:
“Understanding Lua Tables in Corona”
http://blog.anscamobile.com/2011/06/understanding-lua-tables-in-corona-sdk/ [import]uid: 52430 topic_id: 12233 reply_id: 44726[/import]