Methods with parameters

I am fairly new to classes in programming and I had made this method in my experimental class:
function Ground:setBlock(block)
– Codea does not automatically call this method
print(block)
end

In the main class, I call this:
Ground.setBlock(“Dirt”)

In my console, it prints a nil value. Why is this? Do I have to assign the block Parameter to a local variable?

Maybe these will help

https://coolcodea.wordpress.com/2013/03/22/7-classes-in-codea/

https://coolcodea.wordpress.com/2013/03/23/8-classes-in-codea-2/

@niorg2606 Here’s your code changed to work. You need to read the tutorials on classes.

function setup()
    gr=Ground()
    gr:setBlock("Dirt")
end

Ground=class()

function Ground:setBlock(block)
    print(block)
end