MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / contract_api_wrapper

Function contract_api_wrapper

src/Chain/libraries/glua/lauxlib.cpp:1133–1141  ·  view source on GitHub ↗

包装合约的api函数 args: apiFunc, contract_id, ret: wrapedApiFunc

Source from the content-addressed store, hash-verified

1131// 包装合约的api函数
1132// args: apiFunc, contract_id, ret: wrapedApiFunc
1133static 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
1143static bool contract_table_traverser_to_wrap_api(lua_State *L, void *ud)
1144{

Callers

nothing calls this directly

Calls 3

lua_pushvalueFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushcclosureFunction · 0.85

Tested by

no test coverage detected