From 6123f09e9fd8c7d68832a6d33325456316aa6ec9 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Wed, 4 Sep 2019 03:09:07 -0400 Subject: Fixed boolean saving in lua table saving --- Scripts/init.lua | 2 ++ src/components/Script.hpp | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Scripts/init.lua b/Scripts/init.lua index a57e8b3..6f510c1 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -25,6 +25,8 @@ bird = { y = 0.0 }, Name = "bord", + hellotrue = true, + hellofalse = false, Render = { texture = "Assets/player.png", visible = true diff --git a/src/components/Script.hpp b/src/components/Script.hpp index 82381e9..3f96be5 100644 --- a/src/components/Script.hpp +++ b/src/components/Script.hpp @@ -76,11 +76,14 @@ public: key.as(), std::string("return " + value.as()) )); - else if (value.get_type() == sol::type::boolean) + else if (value.get_type() == sol::type::boolean) { table_components.push_back(std::make_tuple( key.as(), - std::string("return " + value.as()) + std::string("return " + + std::string(value.as() ? "true" : "false") + ) )); + } //else if (value.get_type() == sol::type::function) { // sol::state lua; // lua.open_libraries(sol::lib::base, sol::lib::string); -- cgit v1.2.3