diff options
Diffstat (limited to 'LuaSL/src/LSL.lua')
-rw-r--r-- | LuaSL/src/LSL.lua | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index 3810abc..662c880 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua | |||
@@ -82,6 +82,7 @@ end | |||
82 | 82 | ||
83 | events = {} | 83 | events = {} |
84 | 84 | ||
85 | function start() paused = false end | ||
85 | function stop() paused = true end | 86 | function stop() paused = true end |
86 | function quit() running = false end | 87 | function quit() running = false end |
87 | 88 | ||
@@ -761,26 +762,18 @@ function LSL.stateChange(x) | |||
761 | end; | 762 | end; |
762 | 763 | ||
763 | function LSL.mainLoop(sid, name, x) | 764 | function LSL.mainLoop(sid, name, x) |
764 | local status, errorMsg = luaproc.newchannel(sid) | 765 | local status, errorMsg |
765 | local result | 766 | local result |
766 | 767 | ||
767 | SID = sid | 768 | SID = sid |
768 | scriptName = name | 769 | scriptName = name |
769 | |||
770 | LSL.EOF = "\n\n\n" -- Fix this up now. | 770 | LSL.EOF = "\n\n\n" -- Fix this up now. |
771 | 771 | ||
772 | if not status then | ||
773 | msg("Can't open the luaproc channel " .. sid .. " ERROR MESSAGE: " .. errorMsg) | ||
774 | return | ||
775 | end | ||
776 | |||
777 | LSL.stateChange(x); | 772 | LSL.stateChange(x); |
778 | waitAndProcess(false) | 773 | waitAndProcess(false) |
779 | msg("Script quitting.") | 774 | msg("Script quitting.") |
780 | end | 775 | end |
781 | 776 | ||
782 | -- Need a FIFO queue of incoming events. Which will be in the C main thread, coz that's listening on the socket for us. | ||
783 | -- The ecore_con stuff ends up being a FIFO queue of the commands coming from OpenSim. So no worries. | ||
784 | function waitAndProcess(returnWanted) | 777 | function waitAndProcess(returnWanted) |
785 | local Type = "event" | 778 | local Type = "event" |
786 | 779 | ||
@@ -798,6 +791,7 @@ function waitAndProcess(returnWanted) | |||
798 | else | 791 | else |
799 | -- Set the functions environment to ours, for the protection of the script, coz loadstring sets it to the global environment instead. | 792 | -- Set the functions environment to ours, for the protection of the script, coz loadstring sets it to the global environment instead. |
800 | -- TODO - On the other hand, we will need the global environment when we call event handlers. So we should probably stash it around here somewhere. | 793 | -- TODO - On the other hand, we will need the global environment when we call event handlers. So we should probably stash it around here somewhere. |
794 | -- Meh, seems to be working fine as it is. | ||
801 | setfenv(result, getfenv(1)) | 795 | setfenv(result, getfenv(1)) |
802 | status, result = pcall(result) | 796 | status, result = pcall(result) |
803 | if not status then | 797 | if not status then |