lua-users home
lua-l archive

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

On Tue, Sep 20, 2011 at 2:22 PM, Thijs Schreijer
<> wrote:
> 133     local s = pcall(filters:add(123))

Ah, pcall() is passed a _function_, so you need to do this:

local ok, s = pcall(function() return filters:add(123) end)

Here ok will be true or false depending on whether the code threw an
error; s will then be the error, or the result of the function if

In your case, could also do

local ok, s = pcall(filters.add,filters,123)

since pcall() can take arguments.

steve d.