diff options
Diffstat (limited to 'tests/MyGame/Example/Any.go')
-rw-r--r-- | tests/MyGame/Example/Any.go | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/MyGame/Example/Any.go b/tests/MyGame/Example/Any.go index 39b89a79..8d9067e1 100644 --- a/tests/MyGame/Example/Any.go +++ b/tests/MyGame/Example/Any.go @@ -2,18 +2,34 @@ package Example -type Any = byte +import "strconv" + +type Any byte + const ( - AnyNONE Any = 0 - AnyMonster Any = 1 + AnyNONE Any = 0 + AnyMonster Any = 1 AnyTestSimpleTableWithEnum Any = 2 AnyMyGame_Example2_Monster Any = 3 ) var EnumNamesAny = map[Any]string{ - AnyNONE:"NONE", - AnyMonster:"Monster", - AnyTestSimpleTableWithEnum:"TestSimpleTableWithEnum", - AnyMyGame_Example2_Monster:"MyGame_Example2_Monster", + AnyNONE: "NONE", + AnyMonster: "Monster", + AnyTestSimpleTableWithEnum: "TestSimpleTableWithEnum", + AnyMyGame_Example2_Monster: "MyGame_Example2_Monster", } +var EnumValuesAny = map[string]Any{ + "NONE": AnyNONE, + "Monster": AnyMonster, + "TestSimpleTableWithEnum": AnyTestSimpleTableWithEnum, + "MyGame_Example2_Monster": AnyMyGame_Example2_Monster, +} + +func (v Any) String() string { + if s, ok := EnumNamesAny[v]; ok { + return s + } + return "Any(" + strconv.FormatInt(int64(v), 10) + ")" +} |