Re: string.byte returning nothing (Re: Changelog for 5 - 3/3/2003)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: string.byte returning nothing (Re: Changelog for 5 - 3/3/2003)
- From: Egor Skriptunoff <egor.skriptunoff@...>
- Date: 2012年3月21日 19:19:17 +0000 (GMT)
> local a,b,c=(''):byte(),1,2
> print(a,b,c)
> # nil 1 2
>
> I would've thought this should be
> # 1 2 nil
Lua reduces empty result list of
(''):byte()
to one value == nil.
See chapter 'Expressions' in Lua Manual.
> # Note the coma at the end
> local a,b,c=('ab'):byte(1,2),
> print(a,b,c)
> # nil nil nil
It is equivalent to
local a,b,c=('ab'):byte(1,2),print(a,b,c)
It prints your global a,b,c :)
--Egor