lua-users home
lua-l archive

Re: string[], doesn't exist?

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


> > s="lua"
> > print(s[2])
> --> nil
> 
> What does it do?
It tries to get field 2 from string (the table). Since there's no value
at string[2], it returns nil.
Try
	string[2]="hello"
	print(("xxx")[2])
--lhf

AltStyle によって変換されたページ (->オリジナル) /