lua-users home
lua-l archive

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


--- In lua-l@yahoogroups.com, Asko Kauppi <asko.kauppi@s...> wrote: 
>  
> I've done similar things with the Lua/SDL module interfacing, 
probably  
> using both of the methods although I prefer #1. 
>  
> If you wish, have a look at the source from: 
> http://sourceforge.net/projects/luacheia 
 
Method #1 seems to work well in your case since, from the little 
code I've seen, you have to deal with mostly small structs 
containing scalars, strings etc. Moving data from a table to a large 
struct(20 members) with many vectors will result in a pretty long 
and messy function with constantly repeating code. That's whats 
bugging me most. Using C++ function templates would make things 
easier by handling the various type with one function but I don't 
want to mix C++ features in my C code. Anyway, method #2 seems to 
lead to the same mess but at least it moves the bookkeeping of my 
structures to lua. Besides since I'm actually using lua to parse 
files for me, I'm actually better of since manually parsing the 
files would probably lead to messier code. Still if anyone has any 
ideas I'm still interested. 
 
Dimitris