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

Method from

source/core/StarLua.cpp:133–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131LuaNullEnforcer::~LuaNullEnforcer() { if (m_engine) --m_engine->m_nullTerminated; };
132
133LuaValue LuaConverter<Json>::from(LuaEngine& engine, Json const& v) {
134 if (v.isType(Json::Type::Null)) {
135 return LuaNil;
136 } else if (v.isType(Json::Type::Float)) {
137 return LuaFloat(v.toDouble());
138 } else if (v.isType(Json::Type::Bool)) {
139 return v.toBool();
140 } else if (v.isType(Json::Type::Int)) {
141 return LuaInt(v.toInt());
142 } else if (v.isType(Json::Type::String)) {
143 return engine.createString(*v.stringPtr());
144 } else {
145 return LuaDetail::jsonContainerToTable(engine, v);
146 }
147}
148
149Maybe<Json> LuaConverter<Json>::to(LuaEngine&, LuaValue const& v) {
150 if (v == LuaNil)

Callers

nothing calls this directly

Calls 7

JsonClass · 0.85
toDoubleMethod · 0.80
toBoolMethod · 0.80
toIntMethod · 0.80
createStringMethod · 0.80
isTypeMethod · 0.45
stringPtrMethod · 0.45

Tested by

no test coverage detected