lua-users home
lua-l archive

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



Insteead of the regular "_,_, str= string.find( " I'm considering using the following functions:


-----
-- Useful when needing just a single return value (i.e. from 'string.find()')
--
function first( ... ) return arg[1] end
function second( ... ) return arg[2] end
function third( ... ) return arg[3] end


This makes the code easier to read, and is not so obscure as the built-in '( )' notation
(that only extracts the first item anyhow).


What do you normally do - are there better ways to achive this?

-ak