aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LSL.lua
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-25 09:43:05 +1000
committerDavid Walter Seikel2012-02-25 09:43:05 +1000
commitbd82e0ebd6db7ab7a9577c9ec6d9a9a9c2d73db8 (patch)
tree47fb8b023eceb67bb94751d307d7486ced3fed0b /LuaSL/src/LSL.lua
parentPartial rewrite of the luaproc messages. Still not fixed yet. (diff)
downloadSledjHamr-bd82e0ebd6db7ab7a9577c9ec6d9a9a9c2d73db8.zip
SledjHamr-bd82e0ebd6db7ab7a9577c9ec6d9a9a9c2d73db8.tar.gz
SledjHamr-bd82e0ebd6db7ab7a9577c9ec6d9a9a9c2d73db8.tar.bz2
SledjHamr-bd82e0ebd6db7ab7a9577c9ec6d9a9a9c2d73db8.tar.xz
Beat the script messsage passing into shape, mostly by knocking large chunks off. lol
Diffstat (limited to 'LuaSL/src/LSL.lua')
-rw-r--r--LuaSL/src/LSL.lua12
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
83events = {} 83events = {}
84 84
85function start() paused = false end
85function stop() paused = true end 86function stop() paused = true end
86function quit() running = false end 87function quit() running = false end
87 88
@@ -761,26 +762,18 @@ function LSL.stateChange(x)
761end; 762end;
762 763
763function LSL.mainLoop(sid, name, x) 764function 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.")
780end 775end
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.
784function waitAndProcess(returnWanted) 777function 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