lua-users home
lua-l archive

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




On Mon, Jun 20, 2022 at 9:24 AM Budi <budikusasi@gmail.com> wrote:
How to determine the correct data type used in function argument? e.g.

function incr (n)
 -------------------    which type of what?
 n = n .. "foo"

 n = n + 1

end

Hi there, you can use the type() function provided by the Standard Library to check the type of various values. I suggest you should offer the PIL manual an extensive read, it contains a lot of useful information and allows you to learn Lua in a linear fashion.

Here's the manual entry for types and values: https://www.lua.org/pil/2.html