Log In  


Can I/what syntax should be used to specify default values for the parameters of a function?

1


function func(param)
	param = param or 42
	print(param)
end

func(36)
-->36
func()
-->42

Shoot, that's simple. Thank you!


<3 this about Lua



[Please log in to post a comment]