[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string:sub
- From: Scott Vokes <vokes.s@...>
- Date: Sat, 6 Mar 2010 14:05:15 -0500
> Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> =("12345"):sub(1,0)
The reference manual says (pg. 74 /
http://www.lua.org/manual/5.1/manual.html#5.4):
"Indices are allowed to be negative and are interpreted as indexing
backwards, from the end of the string. Thus, the last character is at
position -1, and so on." To me, that means sub(1, 0) should return the
string between the first character and the last character, i.e., the
empty string.
Scott