How to do lua table operations from C? -


I need to work on the lugha tables from C where tables appear in lists or queue forms Is considered in. Especially I need to insert an element on the head and remove the head element, and the other elements need to move forward to adjust the new element.

It will be straightforward in Leah, I Table.insert and table.remove . But in the C

Lua in C API such as lua_settable, but table.insert and the table. Removes those who are in front. It seems that there are internal C functions inside an interpreter named tinsert and tremove , but they are not part of the API.

Do I really want to call a lava function which does it for me?

I believe that you can reuse the function

 <0> Static Int tincert (Lua_State * L) Static Ent Tramov (Lua_State * L)  

and Macro

  #define aux_getn (L, N ) (LuaL_checktype (L, n, LUA_TTABLE), luaL_getn (L, n))  

which are in ltablib.c They rely only on Lea's API.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -