catching physics.addBody error with outline

How to catch error in physics.addBody ?

Code:

[lua]

local result = physics.addBody( objTest, “dynamic”, { outline=oTest } )

print( result )

[/lua]

Corona Simulator Output:

ERROR: C:\path\main.lua:158: physics.addBody() : invalid “outline”

true

pcall() is lua’s exception mechanism

ty very much, that seems to work and catch error :slight_smile:

pcall output:

false   attempt to call a boolean value


EDIT:

ah i actually called pcall wrong. With this:

[lua]print( pcall( physics.addBody, objTest, “dynamic”, { outline=oTest } ) )[/lua]

i get this output:

ERROR: physics.addBody() : invalid “outline”

true    true

pcall() is lua’s exception mechanism

ty very much, that seems to work and catch error :slight_smile:

pcall output:

false   attempt to call a boolean value


EDIT:

ah i actually called pcall wrong. With this:

[lua]print( pcall( physics.addBody, objTest, “dynamic”, { outline=oTest } ) )[/lua]

i get this output:

ERROR: physics.addBody() : invalid “outline”

true    true