diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2025-11-11 14:40:30 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2025-11-11 14:40:30 -0300 |
| commit | 5b7d9987642f72d44223a8e5e79e013bb2b3d579 (patch) | |
| tree | 0a755e85069f2c19609500151fec5b1e6ff30f88 /lgc.c | |
| parent | 81f4def54f440e045b1401f11ef78b65b56b7abe (diff) | |
| download | lua-5b7d9987642f72d44223a8e5e79e013bb2b3d579.tar.gz lua-5b7d9987642f72d44223a8e5e79e013bb2b3d579.tar.bz2 lua-5b7d9987642f72d44223a8e5e79e013bb2b3d579.zip | |
External strings are as good as internal ones
A '__mode' metafield and an "n" key both can be external strings.
Diffstat (limited to 'lgc.c')
| -rw-r--r-- | lgc.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -594,10 +594,10 @@ static void traversestrongtable (global_State *g, Table *h) { | |||
| 594 | */ | 594 | */ |
| 595 | static int getmode (global_State *g, Table *h) { | 595 | static int getmode (global_State *g, Table *h) { |
| 596 | const TValue *mode = gfasttm(g, h->metatable, TM_MODE); | 596 | const TValue *mode = gfasttm(g, h->metatable, TM_MODE); |
| 597 | if (mode == NULL || !ttisshrstring(mode)) | 597 | if (mode == NULL || !ttisstring(mode)) |
| 598 | return 0; /* ignore non-(short)string modes */ | 598 | return 0; /* ignore non-string modes */ |
| 599 | else { | 599 | else { |
| 600 | const char *smode = getshrstr(tsvalue(mode)); | 600 | const char *smode = getstr(tsvalue(mode)); |
| 601 | const char *weakkey = strchr(smode, 'k'); | 601 | const char *weakkey = strchr(smode, 'k'); |
| 602 | const char *weakvalue = strchr(smode, 'v'); | 602 | const char *weakvalue = strchr(smode, 'v'); |
| 603 | return ((weakkey != NULL) << 1) | (weakvalue != NULL); | 603 | return ((weakkey != NULL) << 1) | (weakvalue != NULL); |
