[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tolua, Lua 4.x and enum problem
- From: pixellent@...
- Date: Tue, 14 Jan 2003 15:43:51 -0500
Yes but that didn't work either. Sorry, I should have mentioned that in the
first place.
Thanks
Mike
Quoting Waldemar Celes <celes@inf.puc-rio.br>:
> have you tried this?
>
> horizontal=Habitat.Gui.HB_GUI_HORIZONTAL_LEFT
>
> --waldemar
>
> At 19:20 13/1/2003 -0500, you wrote:
> >I'm trying to expose some enums using tolua. My package file contains:
> >
> >$#include "gui/hbGuiTypes.h"
> >
> >$using namespace Habitat::Gui;
> >
> >module Habitat
> >{
> > module Gui
> > {
> > enum
> > {
> > HB_GUI_HORIZONTAL_LEFT,
> > HB_GUI_HORIZONTAL_RIGHT,
> > HB_GUI_HORIZONTAL_ABSOLUTE,
> > HB_GUI_HORIZONTAL_CENTRE,
> > HB_GUI_VERTICAL_TOP,
> > HB_GUI_VERTICAL_BOTTOM,
> > HB_GUI_VERTICAL_ABSOLUTE,
> > HB_GUI_VERTICAL_CENTRE
> > };
> >
> > }
> >}
> >
> >tolua seems happy, and the tolua_hbGuiTypes_open() function executes no
> >problem. I tried to access one of the enums in my Lua script:
> >
> > function StaticBitmap(t)
> > local horiz = t.horizontal
> > write(horiz)
> > GuiManager:AddComponent(staticBitmap)
> > end
> >
> >then later:
> >
> > StaticBitmap
> > {
> > horizontal=HB_GUI_HORIZONTAL_LEFT
> > }
> >
> >But I'm getting:
> >
> >error: bad argument #1 to `write' (string expected, got nil)
> >stack traceback:
> > 1: function `write' [C]
> > 2: function `StaticBitmap' at line 31 [file `scripts/testSDL/gui.lua']
> > 3: main of file `scripts/testSDL/canvas.gui' at line 11
> > 4: function `Exec' [C]
> > 5: function `InitialiseGUI' at line 8 [file `scripts/testSDL/gui.lua']
> > 6: function `OnStartup' at line 17 [file `scripts/testSDL/main.lua']
> >*** Error while running script file scripts/testSDL/canvas.gui
> >
> >As far as I can see, I have done everything needed, yet I can't get this to
> >work. I've looked through the code for the Doris project, and I can't seen
> >anything drastically different. Am I missing something simple?
> >
> >Many thanks
> >Mike
> >
> >(PS - apologies for the long message.)
>
>