Found a VERY helpful guide, 4. Making Your API Classy - Creating Solid APIs with Lua [Book] and am now using it to rectify C side errors such as no checking of the userdata (which flagged an error on the above script once I compiled and ran it)