lua-users home
lua-l archive

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


> Lua 5.1.4
>
> For example:
>>
>> bar = {}
>> bar.name = 'test'
>> bar['123.com'] = function(self) print(self.name) end
>
> I can't call the method like below:
>>
>> bar:['123.com']()
>> stdin:1: '<name>' expected near '['
>

This has nothing to do with function names.  The tbl.xxx and tbl:xxx
syntax sugar
is available only when xxx is an alphabetic key.