lua-users home
lua-l archive

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


Hi, list!

http://www.lua.org/cgi-bin/demo?account

This demo fails when run:

    Output
    after creation demo 0
    after deposit demo 1000
    after withdraw demo 900
    input:18: insufficient funds on account DEMO

    Your program failed to run.

I do realize that the failure is intentional, but in my opinion it may
be misleading to the newcomers. ("What, they can't even get they own
demo to work?")

I believe that pcall should be added to avoid that scary red fail message.

If failure is there for the right purpose, then at least add a warning
message that this demo is expected to fail. Something like this:

    <...>
    b = Account:new(nil,"DEMO")
    print("About to withdraw too large sum and fail")
    b:withdraw(100.00)

HTH,
Alexander.