summaryrefslogtreecommitdiff
path: root/tests/MyGame/Example/Any.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/MyGame/Example/Any.py')
-rw-r--r--tests/MyGame/Example/Any.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/MyGame/Example/Any.py b/tests/MyGame/Example/Any.py
index f1b8d519..b10d35df 100644
--- a/tests/MyGame/Example/Any.py
+++ b/tests/MyGame/Example/Any.py
@@ -8,3 +8,18 @@ class Any(object):
TestSimpleTableWithEnum = 2
MyGame_Example2_Monster = 3
+
+def AnyCreator(unionType, table):
+ from flatbuffers.table import Table
+ if not isinstance(table, Table):
+ return None
+ if unionType == Any().Monster:
+ import MyGame.Example.Monster
+ return MyGame.Example.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
+ if unionType == Any().TestSimpleTableWithEnum:
+ import MyGame.Example.TestSimpleTableWithEnum
+ return MyGame.Example.TestSimpleTableWithEnum.TestSimpleTableWithEnumT.InitFromBuf(table.Bytes, table.Pos)
+ if unionType == Any().MyGame_Example2_Monster:
+ import MyGame.Example2.Monster
+ return MyGame.Example2.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
+ return None