aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/LSL.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/LSL.lua b/lib/LSL.lua
index 07c8b30..65aef77 100644
--- a/lib/LSL.lua
+++ b/lib/LSL.lua
@@ -788,24 +788,24 @@ function waitAndProcess(returnWanted)
788 if paused then 788 if paused then
789 if "start()" == message then paused = false end 789 if "start()" == message then paused = false end
790 else 790 else
791 result, errorMsg = loadstring(message) -- "The environment of the returned function is the global environment." Though normally, a function inherits it's environment from the function creating it. Which is what we want. lol 791 local result, errorMsg = loadstring(message) -- "The environment of the returned function is the global environment." Though normally, a function inherits it's environment from the function creating it. Which is what we want. lol
792 if nil == result then 792 if nil == result then
793 msg("Not a valid " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. errorMsg) 793 msg("Not a valid " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. errorMsg)
794 else 794 else
795 -- Set the functions environment to ours, for the protection of the script, coz loadstring sets it to the global environment instead. 795 -- Set the functions environment to ours, for the protection of the script, coz loadstring sets it to the global environment instead.
796 -- 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. 796 -- 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.
797 -- Meh, seems to be working fine as it is. 797 -- Meh, seems to be working fine as it is. Or not.
798 setfenv(result, getfenv(1)) 798 setfenv(result, getfenv(1))
799 status, result = pcall(result) 799 local status, result1 = pcall(result)
800 if not status then 800 if not status then
801 msg("Error from " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. result) 801 msg("Error from " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. result1)
802 elseif result then 802 elseif result1 then
803 -- Check if we are waiting for a return, and got it. 803 -- Check if we are waiting for a return, and got it.
804 if returnWanted and string.match(message, "^return ") then 804 if returnWanted and string.match(message, "^return ") then
805 return result 805 return result1
806 end 806 end
807 -- Otherwise, just run it and keep looping. 807 -- Otherwise, just run it and keep looping.
808 status, errorMsg = luaproc.send(sid, result) 808 status, errorMsg = luaproc.send(sid, result1)
809 if not status then 809 if not status then
810 msg("Error sending results from " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. errorMsg) 810 msg("Error sending results from " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. errorMsg)
811 end 811 end
@@ -853,7 +853,7 @@ end
853 853
854-- Called at compiler set up time, to produce the constants.lsl file. 854-- Called at compiler set up time, to produce the constants.lsl file.
855function LSL.gimmeLSL() 855function LSL.gimmeLSL()
856 for i,v in ipairs(constants) do 856 for i, v in ipairs(constants) do
857 local value = LSL[v.name] 857 local value = LSL[v.name]
858 858
859 print(v.Type .. " " .. v.name .. " = " .. value2string(value, v.Type) .. ";") 859 print(v.Type .. " " .. v.name .. " = " .. value2string(value, v.Type) .. ";")