lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Okay, so I've been hacking on this for a while and can't get it to work.
Here's the code I have so far.  Do you guys see anything wrong with it?

luaL_Buffer b;
luaL_buffinit(src,&b);
lua_dump(src, (lua_Chunkwriter)writer, &b);
luaL_loadbuffer(dst, b.buffer, b.p - b.buffer, string);

src = the lua state I'm copying the function from
dst = the lua state I'm copying the function to
string = the name of the function from src

Thanks,

jake

-----Original Message-----
From: Joseph Stewart [mailto:joseph.stewart@gmail.com] 
Sent: Tuesday, January 04, 2005 3:27 PM
To: Lua list
Subject: Re: Is there any easy way to copy lua functions(not c
functions)

Look at the string.dump function in the lua docs... I think this is
what you want.

-joe


On Tue, 4 Jan 2005 13:23:53 -0800, Jacob Devore
<jacob.devore@tko-software.com> wrote:
>  
>  
> 
> from one environment to another? 
> 
>   
> 
> Thanks, 
> 
>   
> 
> jake 


-- 
Person who say it cannot be done should not interrupt person doing it.
 -- Old Scottish Proverb