lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, 27 Apr 2009 20:57:38 -0400
TNHarris <telliamed@whoopdedo.org> wrote:
> 
> Well, I wanted to be case-preserving as well. Though to be honest, I
> can't think of a good reason why.
> 

Now I remember.

    > t = table.casesensitive({}, true)
    > t['A'], t['a'] = 1,2
    > print(t.A == t.a)
    false

Would be true if symbols were folded in the lexer.
And there was a mistake in the patch I posted.

    static int comparename(const TString *s1, const TString *s2) {
      if (s1->tsv.keyhash == s2->tsv.keyhash) return 1;
      return (luai_strcasecmp(getstr(s1), getstr(s2)) == 0);
    }

Should, of course, be

    static int comparename(const TString *s1, const TString *s2) {
      return (s1->tsv.keyhash == s2->tsv.keyhash) &&
              (luai_strcasecmp(getstr(s1), getstr(s2)) == 0);
    }

-- tom
telliamed@whoopdedo.org