Multiple tables and multiple root_type in 1 fbs file is possible in javascript.
examle::
table Login {
name:string;
password:string;
}
table Attack {
damage:short;
}
2 root_type table was made and 2 getRoot function(getRootAsLogin, getRootAsAttack) was made.
But 1 getRootAs function was made when written in C++ using the same schema.
How do I get two getRootAs function in 1 fbs file? split one file into one table?
You can simply use
GetRoot<Login>()andGetRoot<Attack>()if you need other roots than what was declared forroot_type.Splitting into 2 files, each with their own
root_typedeclaration, will also work, if you prefer the generated functions.