Home Contents | # magstripe.new | Magstripe | Core4 Lua Event System

## SYNOPSIS

1. maghandle = magstripe.new(app)
2. maghandle:close()

## DESCRIPTION

Create a new magstripe reader handler. The handler is attached to the event processor passed in app.

The magstripe:close() will close the magstripe device when no longer needed. The handle becomes invalid. This automatically happens during garbage collection, but that takes an unknown amount of time.

## RETURN VALUE

On success, a magstripe handler instance. If opening the magstripe device fails, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library.

## EXAMPLE

> >
app = event.new() mag = magstripe.new(app)

## SEE ALSO

magstripe:enable, magstripe:disable, magstripe:trigger, magstripe.magdataChanged