Is there a way to convert cdata to userdata? How can I use the C api to push/retrieve cdata to/from the stack?
Edit: The original title mentioned luajit but not Torch. In that context the other answers beside the one I finally had submitted myself (e.g wolfgang's) made perfect sense.