[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: tolua, Lua 4.x and enum problem
- From: pixellent@...
- Date: Mon, 13 Jan 2003 19:20:26 -0500
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.)