beautypg.com

ClearOne Writing StreamNet User Manual

Page 13

background image

Handling Commands

3-3

All specifications subject to change without notification. All rights reserved. Copyright © 2007 NetStreams

Main +1 512.977-9393 / fax +1 512.977.9398 / Toll Free Technical Support +1 866-353-3496

3600 W. Parmer Lane, Suite 100; Austin, TX 78727 /

www.netstreams.com.

NOTE

if

(cmd.command == “debug”)

then

… handle the #debug command

end

end

If the command is specific to a particular subNode of the driver, it should be defined as
an element in the subNode. It will be passed the subNode itself as its only argument.

subNode.handle_set =

function

(self, cmd)

if

(cmd.params[1] == “heat”)

then

… handle the #set heat… command

end

end

subNode.default_command_handler =

function

(self,

cmd)

if

(cmd.command == “debug”)

then

… handle the #debug command

end

end

In the previous example,
Lua provides a
convenient short-cut
notation with identical
functionality:

function

subNode:handle_set(cmd)

if

(cmd.params[1] == “heat”)

then

end

end