xeon17 Posted March 9, 2017 Share Posted March 9, 2017 How do i know if a table row is empty? if(self.playerWeapons[player]) then for weapon,ammo in pairs(self.playerWeapons[player]) do player:giveWeapon(weapon, ammo, true) end else -- if empty (this does not work) self:setDefaultWeapons(player) end self.playerWeapons[player] = nil Link to comment
Bonsai Posted March 9, 2017 Share Posted March 9, 2017 What about "#self.playerWeapons[player] ~= 0" ? Link to comment
xeon17 Posted March 9, 2017 Author Share Posted March 9, 2017 Error: [string "if (#test[me] == 0) then print("empty") end"]:1: attempt to get length of field '?' (a boolean value) Link to comment
xeon17 Posted March 10, 2017 Author Share Posted March 10, 2017 nvm, fixed, thanks Bonsai 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