diff options
author | David Walter Seikel | 2012-02-05 17:38:01 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-05 17:38:01 +1000 |
commit | 43510cab3feffebe1de8598759c15db47fb2132a (patch) | |
tree | 7cbeead98ab2cf4dbdef001a3cc5ada004247053 /LuaSL/src | |
parent | Fix up the Lua output filenames and fake SID. (diff) | |
download | SledjHamr-43510cab3feffebe1de8598759c15db47fb2132a.zip SledjHamr-43510cab3feffebe1de8598759c15db47fb2132a.tar.gz SledjHamr-43510cab3feffebe1de8598759c15db47fb2132a.tar.bz2 SledjHamr-43510cab3feffebe1de8598759c15db47fb2132a.tar.xz |
Enable the Lua main loop loopiness, and add a quit option.
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LSL.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index 975f219..59f706d 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua | |||
@@ -336,9 +336,8 @@ function LSL.stateChange(x) | |||
336 | end; | 336 | end; |
337 | 337 | ||
338 | function LSL.mainLoop(SID, x) | 338 | function LSL.mainLoop(SID, x) |
339 | -- TODO - disabled the stuff that waits until I implement the stuff that makes it stop waiting. lol | ||
340 | local sid = SID .. ".events" | 339 | local sid = SID .. ".events" |
341 | local status, errorMsg = "disabled" -- = luaproc.newchannel(sid) | 340 | local status, errorMsg = luaproc.newchannel(sid) |
342 | local result | 341 | local result |
343 | 342 | ||
344 | if not status then | 343 | if not status then |
@@ -350,9 +349,11 @@ function LSL.mainLoop(SID, x) | |||
350 | 349 | ||
351 | -- TODO - Need a FIFO stack of incoming events. Which will be in the C main thread, coz that's listening on the socket for us. | 350 | -- TODO - Need a FIFO stack of incoming events. Which will be in the C main thread, coz that's listening on the socket for us. |
352 | 351 | ||
353 | -- while true do | 352 | while true do |
354 | local message = luaproc.receive(sid) | 353 | local message = luaproc.receive(sid) |
355 | if message then | 354 | if "quit()" == message then |
355 | return | ||
356 | elseif message then | ||
356 | result, errorMsg = loadstring(message) | 357 | result, errorMsg = loadstring(message) |
357 | if nil == result then | 358 | if nil == result then |
358 | print("Not a valid event: " .. message .. " ERROR MESSAGE: " .. errorMsg) | 359 | print("Not a valid event: " .. message .. " ERROR MESSAGE: " .. errorMsg) |
@@ -368,7 +369,7 @@ function LSL.mainLoop(SID, x) | |||
368 | end | 369 | end |
369 | end | 370 | end |
370 | end | 371 | end |
371 | -- end | 372 | end |
372 | end | 373 | end |
373 | 374 | ||
374 | -- Typecasting stuff. | 375 | -- Typecasting stuff. |