Atouk Posted December 7, 2014 Posted December 7, 2014 Hola, tengo un problema: bad argument #1 to 'ipairs (table expected, got nil) En la linea 34. Este es el código: weaponAmmoTable = { [".45ACP 7 Balas"] = {{"M1911", 22}}, ["9x19mm SD"] = {{"M9 SD", 23}}, [".357 Magnum"] = {{"Colt Python", 24}}, ["9x19mm PDW"] = {{"PDW", 28}}, ["9x19mm MP5"] = {{"MP5A5", 29}}, ["7.62x39mm 30 Balas"] = {{"AK-47", 30}}, ["30Rnd STANAG"] = {{"M4", 31}}, ["Cartuchos 1866"] = {{"Winchester 1866", 25}}, ["Cartuchos 2Rnd."] = {{"Escopeta Recortada", 26}}, ["Cartuchos 8Rnd."] = {{"M1014", 27}}, ["5Rnd. M24"] = {{"M24", 34}}, [".303 British"] = {{"Lee Enfield", 33}}, ["M136 Rocket"] = {{"Heat-Seeking RPG", 36}, {"M136 Rocket Launcher", 35}}, others = { {"Paracaidas", 46}, {"Granada Cegadora", 17}, {"M84 Frag.", 16}, {"Cuchillo de Caza", 4}, {"Hacha", 8}, {"Binoculares", 43}, {"Bate", 5}, {"Pala", 6}, {"Palo de Golf", 2} } } getWeaponAmmoTypeName = function(weaponName) for i,weaponData in ipairs(weaponAmmoTable.others) do if weaponName == weaponData[1] then return weaponData[1], weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable[".45ACP 7 Balas"]) do if weaponName == weaponData[1] then return ".45ACP 7 Balas", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["9x19mm SD"]) do if weaponName == weaponData[1] then return "9x19mm SD", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable[".357 Magnum"]) do if weaponName == weaponData[1] then return ".357 Magnum", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["9x19mm PDW"]) do if weaponName == weaponData[1] then return "9x19mm PDW", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["9x19mm MP5"]) do if weaponName == weaponData[1] then return "9x19mm MP5", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["7.62x39mm 30 Balas"]) do if weaponName == weaponData[1] then return "7.62x39mm 30 Balas", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["30Rnd STANAG"]) do if weaponName == weaponData[1] then return "30Rnd STANAG", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["Cartuchos 1866"]) do if weaponName == weaponData[1] then return "Cartuchos 1866", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["Cartuchos 8Rnd."]) do if weaponName == weaponData[1] then return "Cartuchos 8Rnd.", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["Cartuchos 2Rnd."]) do if weaponName == weaponData[1] then return "Cartuchos 2Rnd.", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["5Rnd. M24"]) do if weaponName == weaponData[1] then return "5Rnd. M24", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable[".303 British"]) do if weaponName == weaponData[1] then return ".303 British", weaponData[2] end end for i,weaponData in ipairs(weaponAmmoTable["M136 Rocket"]) do if weaponName == weaponData[1] then return "M136 Rocket", weaponData[2] end end end
Alexs Posted December 7, 2014 Posted December 7, 2014 Hice un comprobación rápida con el Demo de Lua y no dio problemas.
Recommended Posts