As the title implies I need to check if a table has a key even if it’s nil
I’m making a mouse wrapper and… well I need to check values
As the title implies I need to check if a table has a key even if it’s nil
I’m making a mouse wrapper and… well I need to check values
Well, if the value is nil, means the value doesn’t exist and so a key doesn’t either. Can you elaborate more about why you would need to do this?
For dictionaries:
If a key value is nil then the key doesn’t exist in the dictionary when you set a key value to nil you delete the dictionary element
For arrays:
If you use default ways to index an array, like indexing with brackets, using pairs, etc it will “skip” the value you delete in a way, basically reassigning indexes and decreasing all indexes after it by 1. However, if you use the
rawset
andrawget
methods for arrays, this behavior won’t occur.
mk
A lot of useless characters
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.