lua-users home
lua-l archive

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


On 04.02.2011 10:56, Steve Litt wrote:
I think it does help. So I define my new function print() as taking argument
str, so obviously when the program is run str is "Hello World". Then I pass
that str to oldprint(), which is a reference to print(), which has already
been defined as taking an argument, so no further definition or declaration
needed.

Does that about sum it up?

Not really. Any function may take any arguments. Here's an equivalent to your code:

    print = function(...)
        local str = ...
        oldprint("======================================")
        oldprint(str)
        oldprint("======================================")
    end

In fact print take any number of arguments, so this is what you should do:
    print = function(...)
        oldprint("======================================")
        oldprint(...)
        oldprint("======================================")
    end

--
Best regards,
Sergey Rozhenko                 mailto:sergroj@mail.ru