[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Serializing Lua Functions
- From: Hakki Dogusan <dogusanh@...>
- Date: Fri, 08 Dec 2006 01:13:11 +0200
Wesley Smith wrote:
Out of curiosity, has anyone made an attemp to serialize Lua functions
which could potentially be streamed across a network? What I'm
looking for is something like this...
local streamThisFunction =
--params exist elsewhere in script
function(state, someValues, otherParams)
When streamThisFunction is received by another computer, they are able
to call streamThisFunction() and have it behave as if it were called
on the original sender's machine.
If no one has done this, what might be invloved in doing it?
Not exactly streaming, but I did something like in dsas.
I'm sending function as string to server to execute.
There is this code in tests.lua:
print("------- send function to execute (danger!) ------")
local ss = [[
-- from PIL p:33
local mi = 1 -- maximum index
local m = a[mi] -- maximum value
for i,val in ipairs(a) do
if val > m then
mi = i
m = val
return m, mi
local rc = S:call("testapp", "test3")
local m = S:result(0)
local mi = S:result(1)
print("m:" .. m .. " mi:" .. mi)
You can get dsas from http://www.dynaset.org/dogusanh