Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/bfbs_gen_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,6 @@ class LuaBfbsGenerator : public BaseBfbsGenerator {
void EmitCodeBlock(const std::string& code_block, const std::string& name,
const std::string& ns,
const std::string& declaring_file) const {
const std::string root_type = schema_->root_table()->name()->str();
const std::string root_file =
schema_->root_table()->declaration_file()->str();
const std::string full_qualified_name = ns.empty() ? name : ns + "." + name;

std::string code = "--[[ " + full_qualified_name + "\n\n";
Expand All @@ -672,7 +669,15 @@ class LuaBfbsGenerator : public BaseBfbsGenerator {
code += " flatc version: " + flatc_version_ + "\n";
code += "\n";
code += " Declared by : " + declaring_file + "\n";
code += " Rooting type : " + root_type + " (" + root_file + ")\n";

const r::Object* root_table = schema_->root_table();
if (root_table) {
const std::string root_type = root_table->name()->str();
const std::string root_file = root_table->declaration_file()->str();

code += " Rooting type : " + root_type + " (" + root_file + ")\n";
}

code += "\n--]]\n\n";

if (!requires_.empty()) {
Expand Down
Loading