From 95a9ab63d0144cbc5d6ed43b8329bdd7b9085f35 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Fri, 27 Jan 2023 14:34:06 +0100 Subject: [PATCH] added side fromString --- src/kernel/peripherals/Side.hx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/kernel/peripherals/Side.hx b/src/kernel/peripherals/Side.hx index bc4c6ee..ce8dabe 100644 --- a/src/kernel/peripherals/Side.hx +++ b/src/kernel/peripherals/Side.hx @@ -7,4 +7,24 @@ enum abstract Side(String) to String { var Right = "right"; var Front = "front"; var Back = "back"; + + @:from + static public function fromString(s: String) { + switch (s) { + case "top": + return Top; + case "bottom": + return Bottom; + case "left": + return Left; + case "right": + return Right; + case "front": + return Front; + case "back": + return Back; + default: + return null; + } + } }