From f93cf73e01e9cf4b0a6be43d61ebc24b9fa64b0d Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Wed, 22 Feb 2012 23:46:56 +1000 Subject: Implement callAndReturn(), use it from callAndWait(). That's most of LuaSL's side of "use OpenSim to deal with in world stuff". --- LuaSL/src/LSL.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'LuaSL/src/LSL.lua') diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index 8861bf3..b8e2d4b 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua @@ -94,14 +94,19 @@ function args2string(doType, ...) return temp end -function mt.callAndReturn(name, ... ) - print("mt.callAndReturn(" .. name .. "(" .. args2string(true, ...) .. "))") +function mt.callAndReturn(name, ...) + luaproc.sendback(name .. "(" .. args2string(true, ...) .. ")") end -function mt.callAndWait(name, ... ) +function mt.callAndWait(name, ...) local func = functions[name] - print("mt.callAndWait(" .. name .. "(" .. args2string(true, ...) .. "))") + mt.callAndReturn(name, ...); + +--[[ TODO - do a luaproc sync receive() waiting for the result. + Eventually a sendForth() is called, which should end up passing through SendToChannel(). + The format of the result should be something like - SID.result({x=0.45, y=0.6, z=1.8}) +]] if "float" == func.Type then return 0.0 elseif "integer" == func.Type then return 0 -- cgit v1.1