** 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 */
| 6337 | ** being finalized, keep them in keys, but not in values |
| 6338 | */ |
| 6339 | static int iscleared (const TValue *o, int iskey) { |
| 6340 | if (!iscollectable(o)) return 0; |
| 6341 | if (ttisstring(o)) { |
| 6342 | stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ |
| 6343 | return 0; |
| 6344 | } |
| 6345 | return iswhite(gcvalue(o)) || |
| 6346 | (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); |
| 6347 | } |
| 6348 | |
| 6349 | |
| 6350 | /* |