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

Re: [StrongED] Roman numerals



On 15 Aug 2017  Gavin Wraith <gavin@xxxxxxxxxxxxxxx> wrote:

> In message <mpro.ouqmja002a56b0244.pittdj@xxxxxxxxxxxx>
>           David Pitt <pittdj@xxxxxxxxxxxx> wrote:

>> sumnums has more than one issue. adding 'require' as in :-
>>
>> in require "lpeg"
>>
>> helped, [well done !] but it now falls over at line 12.

> I cannot put my finger on sumnums - must have it somewhere, I
> suppose. If it is meant to add up all the positive integers
> occurring in a text then this ought to do as an unsophisticated
> zero-approximation:

> #! lua
> local n = 0
> for line in io.lines (arg[1]) do
>   for x in line:gmatch "%d+" do n += tonumber (x) end -- for
> end -- for
> print "Total = ", n

Sorry, Gavin, and error again. This time "syntax error near "," "

Thanks for all the help offered, but I'm only really playing with 
these scripts, so a solution isn't really important.

Best wishes,

Peter.

-- 
Peter Young (zfc Pt) and family
Prestbury, Cheltenham, Glos. GL52, England
http://pnyoung.orpheusweb.co.uk
pnyoung@xxxxxxxxxxxx

--=20
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives at http://www.Torrens.org/RO/StrongED/index.html