Update device.lua

Removed pl.tablex and pl.pretty and instead wrote own functions.