lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br  Fri May 26 17:15:59 2000
>From: Steve Dekorte <steve@dekorte.com>
>
>
>If I place a hook on "index" for strings like this:
>
>and then do:
>
>  a = "foo"
>  a.test
>
>The gettableHook is called properly.
>
>But if I do:
>
>  "foo".test
>
>I get a syntax error. 
>Is there any way to get both to work the same?

This has nothing to do with "index" or "gettable" tag methods.
It's a sintax problem.
We cannot have the syntax
	"foo".test
because of ambiguity. The code below
	a=b
	"foo".test
is parsed as a=b"foo".test, which is equivalent to
	a=b("foo").test
--lhf