void lua_settable (lua_State *L, int index);

Does the equivalent to t[k] = v, where t is the value at the given index, v is the value at the top of the stack, and k is the value just below the top.

This function pops both the key and the value from the stack. As in Lua, this function may trigger a metamethod for the "newindex" event (see §2.4).

 

lua_settable 前栈情况

-----------------top-------------------
`Val'
1
table
-----------------end-------------------

 

lua_settable(L, -3) 之后


-----------------top-------------------
table
-----------------end-------------------

相关文章:

  • 2021-07-21
猜你喜欢
  • 2022-02-14
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2022-01-06
  • 2021-10-01
相关资源
相似解决方案