1. 程式人生 > >Lua 調用的 C 函數保存 state 的兩種方式: Storing State in C Functions 筆記

Lua 調用的 C 函數保存 state 的兩種方式: Storing State in C Functions 筆記

.com 包裝 ram targe cti gist 方式 機制 key

http://yanbin.is-programmer.com/posts/94214.html

Registery的Key

1. 整數Key用於Lua的引用機制,所以不要使用整數作為Key

2. 通過lua_rawsetp將一個C指針包裝成light userdata作為Key使用

3. 使用字符串作為Key

Lua 調用的 C 函數保存 state 的兩種方式: Storing State in C Functions 筆記