lua-users home
lua-l archive

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

> Could someone tell me how to avoid the error, wchich
> LUA sends when it performs arithmetic operation with
> empty string value.

Consider changing the logic of your program so that the
initial value of A2.value is 0 instead of "" ?

Otherwise, try this:

function optnumber(s)
  return tonumber(s) or (s == "" and 0) or error("expected number, got "..type(s))

or some other variation on the theme.