lua-users home
lua-l archive

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


> >Is there an easy way of registering a new function that wraps
> >write(format()), but called somthing else like 'myprint' for 
> example.  I
> >guess I have to call 'format' with all the args, then pass 
> the results to
> >'write'.
> 
> function printf(...)
>  write(call(format,arg))
> end
> 
> printf("Hello from Lua %s at %s\n",_VERSION,date())

function printf(format, ...)
  write(call(format,arg))
end

(just slight error I think) 

Bah! The number of times I wished for printf and didnt see how easily I
could do it!!

Going to have to put that on the wiki...

Regards,
Nick