s1mple Posted October 3, 2015 Share Posted October 3, 2015 for i,weaponData in ipairs(weaponAmmoTable["Makarov Mag"]) do if weaponName == weaponData[1] then return "Makarov Mag",weaponData[2] end end [2015-10-03 05:55:24] ERROR: [DAYZ]/DayZ/pickups.lua:470: attempt to index global 'weaponAmmoTable' (a nil value) [2015-10-03 05:55:24] ERROR: [DAYZ]/DayZ/pickups.lua:470: attempt to index global 'weaponAmmoTable' (a nil value) Link to comment
1LoL1 Posted October 3, 2015 Share Posted October 3, 2015 Why create unnecessary the same? Here Link to comment
KariiiM Posted October 3, 2015 Share Posted October 3, 2015 weaponAmmoTable Table is empty that mean there's nothing inside it and you trying to loop data from it, logically it will return with errors. Link to comment
Noki Posted October 4, 2015 Share Posted October 4, 2015 If the whole table was empty and he was trying to loop through it, there would be no output. Run this: t = {} for i, v in pairs(t) do outputChatBox(v) end Your table is not defined, simple as that. In Lua, if something is not defined and you try to reference it, it will return nil. Make sure you have defined weaponAmmoTable in your code somewhere. Link to comment
Dealman Posted October 4, 2015 Share Posted October 4, 2015 If the whole table was empty and he was trying to loop through it, there would be no output. Run this: t = {} for i, v in pairs(t) do outputChatBox(v) endYour table is not defined, simple as that. In Lua, if something is not defined and you try to reference it, it will return nil. Make sure you have defined weaponAmmoTable in your code somewhere. Of course it wouldn't output anything from an empty table, that's what KariiiM said. Whether it's not defined or empty, both would return nil errors. Only difference being the actual error. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now