MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / GetDataTableGetContractData

Function GetDataTableGetContractData

src/vm/luavm/lmylib.cpp:1601–1632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1599}
1600
1601static bool GetDataTableGetContractData(lua_State *L, vector<std::shared_ptr<std::vector<uint8_t>>> &ret) {
1602 if (!lua_istable(L,-1)) {
1603 LogPrint(BCLog::LUAVM, "GetDataTableGetContractData is not table\n");
1604 return false;
1605 }
1606
1607 vector<uint8_t> vBuf;
1608 //取脚本id
1609 if (!getArrayInTable(L,(char *)"id",6,vBuf)) {
1610 LogPrint(BCLog::LUAVM,"idTbl not table\n");
1611 return false;
1612 } else {
1613 ret.insert(ret.end(),std::make_shared<vector<uint8_t>>(vBuf.begin(), vBuf.end()));
1614 }
1615
1616 //取key
1617 string key = "";
1618 if (!(getStringInTable(L,(char *)"key",key))) {
1619 LogPrint(BCLog::LUAVM,"key get fail\n");
1620 return false;
1621 } else {
1622 // LogPrint(BCLog::LUAVM, "key:%s\n", key);
1623 }
1624
1625 vBuf.clear();
1626 for (size_t i = 0;i < key.size();i++) {
1627 vBuf.insert(vBuf.end(),key.at(i));
1628 }
1629
1630 ret.insert(ret.end(),std::make_shared<vector<uint8_t>>(vBuf.begin(), vBuf.end()));
1631 return true;
1632}
1633
1634/**
1635 *bool GetContractData(const void* const scriptID,void* const pkey,short len,void* const pValue,short maxlen)

Callers 1

ExGetContractDataFuncFunction · 0.85

Calls 8

getArrayInTableFunction · 0.85
getStringInTableFunction · 0.85
atMethod · 0.80
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected