lua-users home
lua-l archive

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

>>From: Scott Rutledge
>>This could get really messy quickly, so I was thinking of keeping it
simple. The concept would be a thin layer of wrapper functions that takes a
table name, index, and string of source to assign to that table and index.
The layer would do the actual assignment, as well as dump the source to a
structured file of some sort (XML, ini-style, whatever). There would also
have to be calls to handle the addition and removal of tables from the
database, which would make the relevant changes to the source file.
I thought about wrapping dofile, but that would involve manually parsing out
the code, which I'd rather leave to lua itself.

I think you would need to format your source somehow to make it "modular".
Parsing it automatically eg. to group stuff for editing. eg. class and all
member functions could get messy and would the tie up implementaion style?

eg. something parsable like :- (which you could also execute and use as

-- {begin: class Point}
function Point()
    local p = {}
    p.x,p.y = 0,0
    return p
-- {end: class Point}

or you could have tables of source? (which wouldnt require parsing)

_source = {
    ['class Point'] = [[
function Point()
    local p = {}
    p.x,p.y = 0,0
    return p

>>I'd be willing to help work on a library to support this. Sort of on the
topic, had anyone been crazy enough to make an XML parser for lua?

I agree with Reuben, little point in doing this as you could store stuff as
shown above. :-)

Is this whole idea too restrictive and application specific?