"Unexpected identifier" Error in lua trigger code

HI,
Just decided to implement a new TV control in my Vera, and thought I would try it in Workflow.
I have created the states and transitions, but is not detecting my TV coming on.
I am monitoring a device status, with
new==‘1’
in the Lua expression.

but this is giving an error - saying “unexpected identifier new near 1” (see screenshot)
Any sort of entry seems to give a similar problem… any idea on what I am doing wrong gratefully received.

Thanks

That is an illegal expression (as it is telling you)

This is a a comparison operator and should be used as part of a conditional expression or assignment.

i.e.
if ( new == ‘1’) then
print(“New has a value of 1”)
end

or
TestNew = new == ‘1’

In the latter case TestNew will have a value of true or false.

Thanks for prompt response Richard, but this is not a standalone piece of Lua code, it is a condition that sits within a evaluation for a trigger in the State machine.
ie I believe this is the
if ( [LUA EXPRESSION]) then
[EXECUTE TRIGGER CHANGE OF STATE]
print(“New has a value of 1”)
end
part of your example.

In Report format my code looks the same of other examples in the ALtui thread.

You will need to post the WHOLE expression and not a fragment.
Syntax errors else where can cause it to complain here … i.e. a missing single quote previously.

Richard,
new ==‘1’
is the whole expression!
It appears that the editor is correctly flagging a syntax error, but that is a red herring in this context as that snippet is all it needs, or at least, the state machine is working despite the warning.

False alarm.

Thanks for your response

See this post for info on the errant warning: http://forum.micasaverde.com/index.php/topic,48034.0.html

It’s a trade off between getting formatting versus the red X.