lua-users home
lua-l archive

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


Can you send a sample of sourcecode file?

Remo Dentato wrote:
> Hi there!
>  I'm trying to compile and save a function from within lua. This is my
> current approach (assume src is a string containing the source code and
> file is a file opened with "wb"):
> 
> 
>    fun, err = loadstring(src)
>    ...
>    file:write(string.dump(fun))
> 
>   When I look into the generetade file, though, I found the entire
> source code (the src string) preceded by the binary header and followed
> by other Lua VM code.
> 
>   I guess this mean that next time I reload the function the source code
> will be compiled and loaded.
> 
>   I would have liked to have an all binary file as the ones created by
> luac. I understand luac uses the C API to achieve that but I've not be
> able to understand how to do the same within a Lua script!
> 
>   Any insight would be appreciated!
> 
>   Remo
> 
> ------------------------------------------------------------------------
> Live Earth is coming.  Learn more about the hottest summer event - only
> on MSN. Check it out!
> <http://liveearth.msn.com?source=msntaglineliveearthwlm>


-- 
--
Julien Hamaide
Engineering Coach
10Tacle Studios Belgium / Elsewhere Entertainment