Heap memory access in lua -
is possible access contents of heap memory in lua passing pointer memory address allocated malloc function in c?
i have tried :
int *j=(int *)malloc(sizeof(int)); j[0]=5; passing (j pointer lua), lua access contents @ memory location pointed pointer j.
there no built-in support that.
you can write own support in c exporting version of malloc lua creates memory buffers userdata , provides suitable metamethods easy access of contents. (but use lua_newuserdata instead malloc.)
a few of these have appeared in lua mailing list. see instance
Comments
Post a Comment