lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

 

iam new to Lua and i wonder that there are no pointers available in lua! I searched the mailing list and the documentation. I often found table’s and this should solve my problems. But i dont understand the concepts behind ‘tables instead of pointers’. My usecase looks like this:

 

Only a small function that should return the pointer to the current set ‘Face’:

---

// Lua : FaGetCurrent( void );  Lua glueed Functionname

int Face_GetCurrent( lua_State* luaVM )

{

      // Übermitteln wir mal den aktuellen Zeiger

      lua_pushuserdata( luaVM, (PVOID)g_pFace_Current );

 

      // und wech

      return 1;

}

---

 

Next is the corresponding C function wicht returns the Pointer from my selfdefined type LPFACE.

---

LPFACE welFace_GetCurrent( void ){ return g_pFace_Current; }

 

Now i want somthing like that in my luascript

 

PVOID       myPointer = NULL;

myPointer = FaGetCurrent();

 

How do I solve my Problem!

 

Thanks for your advice!

Oliver Düvel