lua-users home
lua-l archive

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



> From: owner-lua-l@tecgraf.puc-rio.br 
> [mailto:owner-lua-l@tecgraf.puc-rio.br] On Behalf Of Martin Spernau
> Sent: February 11, 2003 10:21 AM
> To: Multiple recipients of list
> Subject: Re: wxWindows vs. FLTK
> 
> 
> From: "Eero Pajarre" <epajarre@koti.soon.fi>
> > I have also thought the documentation/example issue and I think
> > that at least on the lowest level it is an advantage if the usage
> > resembles the C++ bindings. I guess it would be possible to
> > layer higher lever stuff on that kind of interface.
> 
> Ah... kind of a low-level binding from C++ to Lua and a 
> high-level wrapper
> around that written in Lua. That could very well be a good way to
> 'bootstrap' in the beginning, and build on that later.
> One might even expose only the higher-level Lua layer to 
> end-users, and
> later do the bindings directly using that 'API'...

I think this is the approach that was discussed last time this module
project was discussed.

http://lua-users.org/lists/lua-l/2002-02/msg00047.html

This is the approach I have taken in doris.sf.net. eg. I wrapped the
GLUI C++ tolua binding so I can use Luas nice table syntax. If the
library interface looked like C++, why not just use C++? eg.


-- Create our window and specify a name and window rendering function
wmain = Window:create{
   title="Doris: Light example",
   render=RenderScene
}

-- Put a sub window at the bottom of the screen
sw = SubWindow{ parent=wmain, side="bottom" }

-- Add an object rotator to the bottom of the screen that
-- manipulates the matrix we created.
Rotator{ parent=sw, text="Rotate teapot",
             value=rotatemat, line="|", spin = .9
}

-- Some spinners to manipulate the colour...
Spinner{ parent=sw, text="Red", 
     value=colour[1], type="float", limits={0,1}, 
     update=function(c) 
         colour[1]=c
         glLight(GL_LIGHT0, GL_AMBIENT, colour)
     end
}
...