comparison Core/Lua/LuaContext.cpp @ 2220:0fb6e0461105

fix handling of Booleans in Lua
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Dec 2016 11:43:35 +0100
parents b1291df2f780
children a3a65de1840f
comparison
equal deleted inserted replaced
2219:262fcab24024 2220:0fb6e0461105
495 { 495 {
496 // Caution: The "lua_isstring()" case must be the last, since 496 // Caution: The "lua_isstring()" case must be the last, since
497 // Lua can convert most types to strings by default. 497 // Lua can convert most types to strings by default.
498 result = std::string(lua_tostring(lua_, top)); 498 result = std::string(lua_tostring(lua_, top));
499 } 499 }
500 else if (lua_isboolean(lua_, top))
501 {
502 result = lua_toboolean(lua_, top) ? true : false;
503 }
500 else 504 else
501 { 505 {
502 LOG(WARNING) << "Unsupported Lua type when returning Json"; 506 LOG(WARNING) << "Unsupported Lua type when returning Json";
503 result = Json::nullValue; 507 result = Json::nullValue;
504 } 508 }