diff options
author | alexzhornyak <alexander.zhornyak@gmail.com> | 2017-05-08 06:43:55 (GMT) |
---|---|---|
committer | alexzhornyak <alexander.zhornyak@gmail.com> | 2017-05-08 06:43:55 (GMT) |
commit | 3654c1e42a3145658b2503309b74d0ad6c4066ea (patch) | |
tree | 04a49bc399c03e1031feb012b3173dc0deff70e5 /src/uscxml/plugins/datamodel | |
parent | 4f2dee08e0e77fcccd55a17add874f4a1ebc1be8 (diff) | |
download | uscxml-3654c1e42a3145658b2503309b74d0ad6c4066ea.zip uscxml-3654c1e42a3145658b2503309b74d0ad6c4066ea.tar.gz uscxml-3654c1e42a3145658b2503309b74d0ad6c4066ea.tar.bz2 |
Fix issue 116
Creating temporary variable for assigning function
Diffstat (limited to 'src/uscxml/plugins/datamodel')
-rw-r--r-- | src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp index 97d3637..899237a 100644 --- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp +++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp @@ -79,9 +79,12 @@ static int luaEval(lua_State* luaState, const std::string& expr) { static Data getLuaAsData(lua_State* _luaState, const luabridge::LuaRef& lua) { Data data; if (lua.isFunction()) { - // TODO: this might lead to a stack-overflow - luabridge::LuaRef luaEvald = lua(); - return getLuaAsData(_luaState, luaEvald); + // we are creating __tmpFunc + // then it will be assigned to data variable + luabridge::setGlobal(_luaState, lua, "__tmpFunc"); + + data.atom = "__tmpFunc"; + data.type = Data::INTERPRETED; } else if(lua.isLightUserdata() || lua.isUserdata()) { // not sure what to do } else if(lua.isThread()) { |