lua-users home
lua-l archive

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


Op Wo. 23 Jan. 2019 om 17:03 het Kenneth Lorber <keni@his.com> geskryf:
>
> (A related question was posed in a different manner back in 2007 but the discussion didn't go anywhere after noting a grammar conflict that IMHO is not relevant for useful use cases. [1])
>
> When is a string not a string?  When it's string literal.
>
> Here's a trivial example adapted from a different context[2]:
>
> > function string:alike(other) return self:lower() == other:lower() end
> > s = "WomBat"
> > s:alike"wombat"
> true
> > "wombat":alike(s)
> stdin:1: unexpected symbol near '"wombat"'

This is a syntax error. You need parentheses.

> ("wombat"):alike(s)
true