FANDOM


Terminates the last protected function called and returns message as the error message. Function error never returns.

error (message [, level])

Parameters Edit

Arguments Edit

message
string - The error message to propagate.
level
integer - Usually, error adds some information about the error position at the beginning of the message. The level argument specifies how to get the error position. With level 1 (the default), the error position is where the error function was called. Level 2 points the error to where the function that called error was called; and so on. Passing a level 0 avoids the addition of error position information to the message.

Returns Edit

none

Example Edit

Function foo(x)
  if x=0 then
    error("Argument for function foo cannot be zero",2)
  end

  return 55378008/x
end

Notes Edit

Related Functions Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.