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

Method to

source/game/scripting/StarLuaGameConverters.cpp:21–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21Maybe<InventorySlot> LuaConverter<InventorySlot>::to(LuaEngine&, LuaValue const& v) {
22 if (auto str = v.ptr<LuaString>()) {
23 auto string = str->toString();
24 if (string.equalsIgnoreCase("swap"))
25 return {SwapSlot()};
26 else if (string.equalsIgnoreCase("trash"))
27 return {TrashSlot()};
28 else if (auto equipment = EquipmentSlotNames.leftPtr(str->toString()))
29 return {*equipment};
30 else
31 return {};
32 }
33 else if (auto table = v.ptr<LuaTable>())
34 return {BagSlot(table->get<LuaString>(1).toString(), (uint8_t)table->get<unsigned>(2))};
35 else
36 return {};
37}
38
39LuaValue LuaConverter<CollisionKind>::from(LuaEngine& engine, CollisionKind k) {
40 return engine.createString(CollisionKindNames.getRight(k));

Callers

nothing calls this directly

Calls 15

ActorJumpProfileClass · 0.85
jsonToStatModifierFunction · 0.85
LiquidLevelClass · 0.85
CollectionClass · 0.85
CollectableClass · 0.85
iterateMethod · 0.80
orMaybeMethod · 0.80
hasRightValueMethod · 0.80
toStringMethod · 0.45
equalsIgnoreCaseMethod · 0.45

Tested by

no test coverage detected