** The next function tells whether a key or value can be cleared from ** a weak table. Non-collectable objects are never removed from weak ** tables. Strings behave as `values', so are never removed too. for ** other objects: if really collected, cannot keep them; for userdata ** being finalized, keep them in keys, but not in values */
| 335 | ** being finalized, keep them in keys, but not in values |
| 336 | */ |
| 337 | static int iscleared (const TValue *o, int iskey) { |
| 338 | if (!iscollectable(o)) return 0; |
| 339 | if (ttisstring(o)) { |
| 340 | stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ |
| 341 | return 0; |
| 342 | } |
| 343 | return iswhite(gcvalue(o)) || |
| 344 | (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); |
| 345 | } |
| 346 | |
| 347 | |
| 348 | /* |