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

Function lua_push_storage_value

src/Chain/libraries/glua/lthinkyounglib.cpp:215–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215bool lua_push_storage_value(lua_State *L, const GluaStorageValue &value)
216{
217 if (nullptr == L)
218 return false;
219 switch (value.type)
220 {
221 case thinkyoung::blockchain::StorageValueTypes::storage_value_int: lua_pushinteger(L, value.value.int_value); break;
222 case thinkyoung::blockchain::StorageValueTypes::storage_value_bool: lua_pushboolean(L, value.value.bool_value); break;
223 case thinkyoung::blockchain::StorageValueTypes::storage_value_number: lua_pushnumber(L, value.value.number_value); break;
224 case thinkyoung::blockchain::StorageValueTypes::storage_value_null: lua_pushnil(L); break;
225 case thinkyoung::blockchain::StorageValueTypes::storage_value_string: lua_pushstring(L, value.value.string_value); break;
226 case thinkyoung::blockchain::StorageValueTypes::storage_value_stream: {
227 auto stream = (thinkyoung::lua::lib::GluaByteStream*) value.value.userdata_value;
228 lua_pushlightuserdata(L, (void*) stream);
229 luaL_getmetatable(L, "GluaByteStream_metatable");
230 lua_setmetatable(L, -2);
231 } break;
232 default: {
233 if(thinkyoung::blockchain::is_any_table_storage_value_type(value.type)
234 || thinkyoung::blockchain::is_any_array_storage_value_type(value.type))
235 {
236 lua_push_storage_table_value(L, value.value.table_value, value.type);
237 break;
238 }
239 lua_pushnil(L);
240 }
241 }
242 return true;
243}
244
245static GluaStorageChangeItem diff_storage_change_if_is_table(lua_State *L, GluaStorageChangeItem change_item)
246{

Callers 4

lthinkyoung_set_storageFunction · 0.85
json_to_luaFunction · 0.85

Calls 10

lua_pushintegerFunction · 0.85
lua_pushbooleanFunction · 0.85
lua_pushnumberFunction · 0.85
lua_pushnilFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_setmetatableFunction · 0.85

Tested by

no test coverage detected