App error when trying to get the count of an array

If have the following code

[lua]
local function populateContactsList ()

– insert rows into list ( tableView widget )
_UserloadContacts()

local ContactList = loadsave.loadTable("__contacts.json")
local ListOfContacts = {}
local ListOfContacts_status = {}
local ListOfContacts_pass = {}

txt_debug.text = txt_debug.text … “\n” … #ContactList … " contacts"

–for i=1, #ContactList do
–ListOfContacts[i] = ContactList[i][“name”]
–ListOfContacts_status[i] = ContactList[i][“status”]
–ListOfContacts_pass[i] = ContactList[i][“1a_pass”]
–end

txt_debug.text = txt_debug.text … “\narrays loaded”
end
[/lua]

my code works fine on the simulator but when i build for my debug device ( Android Galaxy SII 2.3 ) the an error ( " This application encountered a Lua error ( see logs ) …".

After some substitution I narrowed the cause of my error down to #ContactList. Everytime I try to get the count of that array, the error pops up. Anyone please?
[import]uid: 121768 topic_id: 35954 reply_id: 335954[/import]

I’d guess that ContactList isn’t actually a table under certain circumstances (like if the app fails to load “__contacts.json”). What do the logs say? [import]uid: 199237 topic_id: 35954 reply_id: 142890[/import]

So, yeah. “Certain circumstances” helped me out.

My problem is that the function I used to populate “__contacts.json” was querying my database (WHERE clause) with the unique ID of the simulator and the IMEI number of the device when I build.

The database is populated with test data using the simulator unique id.

Sorted. Thanks. [import]uid: 121768 topic_id: 35954 reply_id: 142990[/import]

I’d guess that ContactList isn’t actually a table under certain circumstances (like if the app fails to load “__contacts.json”). What do the logs say? [import]uid: 199237 topic_id: 35954 reply_id: 142890[/import]

So, yeah. “Certain circumstances” helped me out.

My problem is that the function I used to populate “__contacts.json” was querying my database (WHERE clause) with the unique ID of the simulator and the IMEI number of the device when I build.

The database is populated with test data using the simulator unique id.

Sorted. Thanks. [import]uid: 121768 topic_id: 35954 reply_id: 142990[/import]

I’d guess that ContactList isn’t actually a table under certain circumstances (like if the app fails to load “__contacts.json”). What do the logs say? [import]uid: 199237 topic_id: 35954 reply_id: 142890[/import]

So, yeah. “Certain circumstances” helped me out.

My problem is that the function I used to populate “__contacts.json” was querying my database (WHERE clause) with the unique ID of the simulator and the IMEI number of the device when I build.

The database is populated with test data using the simulator unique id.

Sorted. Thanks. [import]uid: 121768 topic_id: 35954 reply_id: 142990[/import]

I’d guess that ContactList isn’t actually a table under certain circumstances (like if the app fails to load “__contacts.json”). What do the logs say? [import]uid: 199237 topic_id: 35954 reply_id: 142890[/import]

So, yeah. “Certain circumstances” helped me out.

My problem is that the function I used to populate “__contacts.json” was querying my database (WHERE clause) with the unique ID of the simulator and the IMEI number of the device when I build.

The database is populated with test data using the simulator unique id.

Sorted. Thanks. [import]uid: 121768 topic_id: 35954 reply_id: 142990[/import]