Byte Ptr to Type...how?

BlitzMax Forums/BlitzMax Programming/Byte Ptr to Type...how?

Is there any way to cast or convert a byte pointer to a type? Lua has a function "lua_newuserdata()" that returns a byte pointer to a chunk of data which holds your object.

Ideally, I'd like to be able to do the following:
Type testtype
Field name$
Field inta:Int[]
EndType

Global tt:testtype  

tt = testtype(lua_newuserdata(ls, SizeOf(testtype))) 'trying to cast here gives the error "Unable to convert from
 'byte pointer to <unknown>"



Is this in any way possible?

If not, ugh, the alternative is going to be bulky and slow.