game.lua:252: attempt to index field '?' Help!

So here is my code for settings.lua (it is not all of the code but some of it.). 

 for i = 1, M.n.totalButtons do M.m.group[i].amount = 0; end M.m.group[1].cost = 20; M.m.group[2].cost = 150; M.m.group[3].cost = 1000; M.m.group[4].cost = 5000; M.m.group[5].cost = 10000; M.m.group[6].cost = 25000; M.m.group[7].cost = 60000; M.m.group[8].cost = 350000; M.m.group[9].cost = 1000000; M.m.group[10].cost = 38000000; M.m.group[11].cost = 100000000; M.m.group[12].cost = 1000000000; M.m.group[13].cost = 25000000000; M.m.group[14].cost = 100000000000; M.m.group[15].cost = 500000000000; M.m.group[16].cost = 1000000000000; M.m.group[17].cost = 999999999999999999999;

and here is part of the game lua where it says error:

group[i].costText = display.newText(""..translations["SHORT\_K"][settings.m.language].." "..comma\_value(settings.m.group[i].cost).."",group[i].image.x,group[i].image.y - 5, font, buttonFontSize)

and this is the error message:

so can you all help me please?

Oh my god thanks, I debugged the problem, but I would like to know why that happened.

There is something in this expression:

group[i].costText = display.newText(""..translations["SHORT\_K"][settings.m.language].." "..comma\_value(settings.m.group[i].cost)..""

that was nil. So perhaps the translations table didn’t have a member named SHORT_K or settings.m.language was nil or the function comma_value() returned nil. 

BTW: you can shorten this a bit. The empty strings on the end isn’t needed:

group[i].costText = display.newText(translations["SHORT\_K"][settings.m.language].." "..comma\_value(settings.m.group[i].cost)

Oh my god thanks, I debugged the problem, but I would like to know why that happened.

There is something in this expression:

group[i].costText = display.newText(""..translations["SHORT\_K"][settings.m.language].." "..comma\_value(settings.m.group[i].cost)..""

that was nil. So perhaps the translations table didn’t have a member named SHORT_K or settings.m.language was nil or the function comma_value() returned nil. 

BTW: you can shorten this a bit. The empty strings on the end isn’t needed:

group[i].costText = display.newText(translations["SHORT\_K"][settings.m.language].." "..comma\_value(settings.m.group[i].cost)