diff --git a/examples/time_broadcast/time_broadcast.json b/examples/time_broadcast/time_broadcast.json new file mode 100644 index 0000000..ddb69dc --- /dev/null +++ b/examples/time_broadcast/time_broadcast.json @@ -0,0 +1,6 @@ +{ + "name" : "time_broadcast", + "internal": true, + "instances" : 1, + "auto_start": true +} diff --git a/examples/time_broadcast/time_broadcast.lua b/examples/time_broadcast/time_broadcast.lua index 3415d8f..7a6cfbd 100644 --- a/examples/time_broadcast/time_broadcast.lua +++ b/examples/time_broadcast/time_broadcast.lua @@ -12,17 +12,13 @@ time_broadcast["run"]=function() "cid" : 5, "message" : [ "" ] }]]); - while true + while not must_stop() do time_broadcast.nap:usleep(1000000); local timenow=os.time(); local timestr=os.date("%c",timenow); oon.message[1]="Server time: "..timestr; bcast:send(1000,oon); - if(must_stop()) - then - break; - end end end