lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

Well, I found out where the problem is : this function is launched from another thread, for which the context as been created using lua_newState() followed obviously by luaL_openlibs().
But it seems in this new context strings functions don't exists :
        Selenite/HDB.sel:316: attempt to call global 'strlen' (a nil value)
so I guess it's the same for string comparison : I think I missed something that made strings unknown to Lua.

Where did I made a mistake ?

Thanks

Laurent




Le Dimanche 25 octobre 2015 11h53, Laurent FAILLIE <l_faillie@yahoo.com> a écrit :


Hello,

Can someone explains to me why the following code is failling ?

----
function Command( topic, val )
print('cmd', topic, '"'..val..'"')
print(type(val))
    if val == "Grab" then
print 'grab'
        srf:Dump('/tmp', 'DashBoard')
    else
print("different")
    end
end
-----

The output is the follwing :

----
cmd    HomeDashBoard/Tablette/Command    "Grab"
string
different
----

As you can see the received string is Grab and is supposed to match the if statement ... but is not.

It's probably a stupid mistake ... but where ?

Thanks

Laurent