包装合约的api函数 args: apiFunc, contract_id, ret: wrapedApiFunc
| 1131 | // 包装合约的api函数 |
| 1132 | // args: apiFunc, contract_id, ret: wrapedApiFunc |
| 1133 | static int contract_api_wrapper(lua_State *L) |
| 1134 | { |
| 1135 | // 获取合约id,加入upval/关联到这个closure |
| 1136 | const char *contract_id = luaL_checkstring(L, 2); |
| 1137 | lua_pushvalue(L, 1); // 压函数本身入栈 |
| 1138 | lua_pushstring(L, contract_id); |
| 1139 | lua_pushcclosure(L, &contract_api_wrapper_func, 2); |
| 1140 | return 1; |
| 1141 | } |
| 1142 | |
| 1143 | static bool contract_table_traverser_to_wrap_api(lua_State *L, void *ud) |
| 1144 | { |
nothing calls this directly
no test coverage detected