]> code.bitgloo.com Git - clyne/gamedev2.git/commitdiff
Fixed boolean saving in lua table saving
authorAndy Belle-Isle <drumsetmonkey@gmail.com>
Wed, 4 Sep 2019 07:09:07 +0000 (03:09 -0400)
committerAndy Belle-Isle <drumsetmonkey@gmail.com>
Wed, 4 Sep 2019 07:09:07 +0000 (03:09 -0400)
Scripts/init.lua
src/components/Script.hpp

index a57e8b38d89541a11e941b2f390b7406a439ae12..6f510c1861db51bab7f62eee7512fdd405692b71 100644 (file)
@@ -25,6 +25,8 @@ bird = {
         y = 0.0
     },
     Name = "bord",
+    hellotrue = true,
+    hellofalse = false,
     Render = {
         texture = "Assets/player.png",
         visible = true
index 82381e953a22e9c2b28334a94abc0f4c5169df01..3f96be5ef8198ab6e30398d63e1c9f30962ac171 100644 (file)
@@ -76,11 +76,14 @@ public:
                     key.as<std::string>(),
                     std::string("return " + value.as<std::string>())
                 ));
-            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>(),
-                    std::string("return " + value.as<std::string>())
+                    std::string("return " + 
+                        std::string(value.as<bool>() ? "true" : "false")
+                    )
                 ));
+            }
             //else if (value.get_type() == sol::type::function) {
             //    sol::state lua;
             //    lua.open_libraries(sol::lib::base, sol::lib::string);