MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / to

Method to

source/core/StarLua.cpp:149–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149Maybe<Json> LuaConverter<Json>::to(LuaEngine&, LuaValue const& v) {
150 if (v == LuaNil)
151 return Json();
152
153 if (auto b = v.ptr<LuaBoolean>())
154 return Json(*b);
155
156 if (auto i = v.ptr<LuaInt>())
157 return Json(*i);
158
159 if (auto f = v.ptr<LuaFloat>())
160 return Json(*f);
161
162 if (auto s = v.ptr<LuaString>())
163 return Json(s->toString());
164
165 if (v.is<LuaTable>())
166 return LuaDetail::tableToJsonContainer(v.get<LuaTable>());
167
168 return {};
169}
170
171LuaValue LuaConverter<JsonObject>::from(LuaEngine& engine, JsonObject v) {
172 return engine.luaFrom<Json>(Json(std::move(v)));

Callers

nothing calls this directly

Calls 8

JsonClass · 0.85
toObjectMethod · 0.80
arrayPtrMethod · 0.80
toArrayMethod · 0.80
objectPtrMethod · 0.80
toStringMethod · 0.45
typeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected