Re: modularizing lua code
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: modularizing lua code
- From: Tomas <tomas@...>
- Date: 2006年7月19日 16:10:45 -0300 (BRT)
Hi Guido
If I am passing structured data (hash table that can contain other
hash tables, no cycles, nothing fancy, really), from the app server to
the Lua application, how is this done in a very simple way?
Simple goal is to share/transport data structures back and forth from
the application server. Parsing JSON response from the RoR app server
takes too long, so am considering a Lua native format for marshalled
objects. Is there a spec or description of that so I can extend the
RoR app to ouput Lua directly? And how would I unpack it from text in
Lua? doFile? Is there a safe way to do this?
Take a look at the session library in CGILua package. It
uses a function to serialize tables (without cycles) which are stored
in the filesystem and retrieved with "dofile". I think ALua uses the
same approach to comunicate over the network, by serializing Lua code
(not only data) and sending it to the receiver. Rings, which is a
library that allows the creation of Lua states from Lua, also uses
strings to communicate, but it does not offer any tool to generate it.
I don't know what level of safety you need, but I think a simple "dofile"
should do the job. Anyway you could take a look at these other tools.
Tomas