Luau Bindings — nfc
The require("nfc") script API — the PN532 NFC reader (over DeMon's I²C). Detect tags and read UIDs, read/write NTAG and Mifare Classic, and read NDEF URI records. Every function is [antos]. Design & native core: antos_nfc; the wider subsystem (NDEF, dbfs:// tag switching, wiring) is NFC.
local nfc = require("nfc")
if nfc.ready() then
local card = nfc.read(2000) -- wait up to 2s for a tag
if card then print("UID:", card.uid) end
end
Detection & identity
| Function |
Behaviour |
nfc.ready() |
Reader present and up? |
nfc.read([timeout_ms]) |
Wait for a tag → a card table { uid, type, … }, or nil on timeout. |
nfc.identify() |
Identify the present card's type. |
nfc.version() |
PN532 firmware version. |
NTAG / NFC Forum Type 2
| Function |
Behaviour |
nfc.ntag_read(page) · nfc.ntag_write(page, data) |
Read / write a 4-byte page. |
nfc.read_uri() · nfc.write(record) |
Read an NDEF URI record / write a record. |
Mifare Classic
| Function |
Behaviour |
nfc.mifare_auth(block, key, keytype) |
Authenticate a sector (keytype A/B). |
nfc.mifare_read(block) · nfc.mifare_write(block, data) |
Read / write a 16-byte block. |
Reader control & diagnostics
| Function |
Behaviour |
nfc.claim() · nfc.release() |
Take / release exclusive use of the reader (so two consumers don't collide). |
nfc.reset_test() · nfc.debug() |
Diagnostics. |
This is the tag reader. The machine's own identity/attestation is the ATECC608C secure element, not an NFC tag — different hardware, different job.
Related