lua-users home
lua-l archive

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


> Got it corrected when I used string.find(a,',',1,string.len(a))

This works, but it is confusing.  You are giving the return
value of string.len as the fourth argument to string.find.
The reason it works is that string.find is returning a
number, and all numbers are true, but the more
straightforward way to do it is to use a boolean (because
the only thing about that fourth argument that string.find
cares about is its truth value):

> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > a = 'foo.bar'
> > return string.find(a, '.', 1, true)
> 4       4

-- 
Aaron
http://arundelo.com/