summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
authoralexzhornyak <alexander.zhornyak@gmail.com>2017-05-08 06:43:55 (GMT)
committeralexzhornyak <alexander.zhornyak@gmail.com>2017-05-08 06:43:55 (GMT)
commit3654c1e42a3145658b2503309b74d0ad6c4066ea (patch)
tree04a49bc399c03e1031feb012b3173dc0deff70e5 /src/uscxml
parent4f2dee08e0e77fcccd55a17add874f4a1ebc1be8 (diff)
downloaduscxml-3654c1e42a3145658b2503309b74d0ad6c4066ea.zip
uscxml-3654c1e42a3145658b2503309b74d0ad6c4066ea.tar.gz
uscxml-3654c1e42a3145658b2503309b74d0ad6c4066ea.tar.bz2
Fix issue 116
Creating temporary variable for assigning function
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp9
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()) {