This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Strange thing in Lua
#1
I'm trying prepare some solution but I've have some strange problem in one script. I am trying fill the 'responseType' property in state variable but it is not working.


Code:
local responseType = cmd.responseType
log('responseType', responseType)
local state = {value = responseType, responseType = responseType, data = data}
log('state', state)
table.insert(states, state)


And this is from Logs:

Code:
Test 15.08.2018 17:46:04
* arg: 1
 * string: responseType
* arg: 2
 * string: outputsState

Test 15.08.2018 17:46:04
* arg: 1
 * string: state
* arg: 2
 * table:
  [value]
   * string: outputsState
  [data]
   * string: ��

Test 15.08.2018 17:46:04
* arg: 1
 * string: responseType
* arg: 2
 * string: inputsState

Test 15.08.2018 17:46:04
* arg: 1
 * string: state
* arg: 2
 * table:
  [value]
   * string: inputsState
  [data]
   * string: ��

It looks like in this table it is not possible to add responseType property because it is not visible. Or I cannot type property with a capital letter. It is strange because in cmd table I am using such property so it should be possible.

Also such situation is very strange:

Code:
local states = satel:getStates()
log(states[1], states[2])
log(states[2])


Logs:

Code:
Test 15.08.2018 18:11:56
* arg: 1
 * table:
  [name]
   * string: outputsState
  [data]
   * string: ��

Test 15.08.2018 18:11:56
* table:
[name]
 * string: inputsState
[data]
 * string: ��


Yesterday I've received this LM and it has firmware 20180523. So maybe this is the case?

Aha, it looks that when in the table there is some binary/hex value then log() function can cause some strange behaviours because when I've changed data to some simple string print is appropriate.
Done is better than perfect
Reply
#2
I've found another similar situation:

I have a custom library 'user.blinds' and when all functions in this library are global then when I require this library in some script I have an access to function dayScene. But after changing a few functions in this library to local variables but not dayScene then in script I cannot reach this function. Only when I do such thing:

Code:
-- GLOBALS in 'user.blinds'
function dayScene()
 execScene()
 alert('day')
end

dayscene = dayScene


And then in script I can reach dayscene function but not dayScene so I see that when there are some local variables in global scope of module then probably all variables are indexed and then camelCase is unfortunately dropped.
Done is better than perfect
Reply
#3
You can use loghex() for binary data but then all strings will be converted to hex which is not convenient if you mix both readable and binary data.

As for user library, please provide the source and full test case.
Reply
#4
I don't use in this situation hex, I have only a problem with camelCase noted variables from module.
Done is better than perfect
Reply


Forum Jump: