1. Hello dear community,

    i just started learning lua but do have experience in other languages already, not that professional software engineer you might think now, but not the newcomer to everything either. so here is my problem and i hope you can help me out.

    The exact part of the book is Page 36, "Displaying a Personalized Greeting Redux"

    Basically i tried the code for the greeting function out by myself, with different values but same structure...it didn't work, after a couple attempts of solving it myself i just typed it in exactly how it's written down in the book:

    function greeting(name)

    if (type(name) == "string") then
        print ("Hello " .. name)
    elseif (type(name) == "nil") then
        print ("Hello friend")
        error("Invalid name was entered")


    My guess is that something has been updated and doesn't work how it is showed in the book anymore or i am just plain stupid, i am looking forward to be enlightened, thanks in advance.

    unless it's a typo, did you add print Greeting(name) where name is replaced by something like john?


    if this turns out to be completely useless it's cause my memory fails me and I dont have the book next to me =o(

    yeah i added something like that, to test it out... and no it's not completely useless cause you reminded me of something that is worth mentioning.... it would always only produce the "second option" as in "hello friend".... with some other values it would give the error message, but it would never produce the actual thing this piece of code is going for "hello name" (where name is ofc a placeholder for the name u enter into the function, like john).

    thank you for reminding me

    the problem obviously was the missing quotation when calling the function, for examble greeting(John) instead of greeting("John") ... thanks anyway