[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Serializing Lua Functions
- From: "Ivan Smirnov" <i.s.smirnov@...>
- Date: Thu, 7 Dec 2006 16:15:33 -0700
I wonder if there is a more convenient and elegant way to do this.
On 12/7/06, Hakki Dogusan <firstname.lastname@example.org> wrote:
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
Department of Math and Stat Sciences
University of Alberta
Edmonton, AB, Canada