lua-users home
lua-l archive

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


SCSL_Draw_Rect(lua_State*L)
{
        GUI_Color_t asvDrawColor = {31, 31, 0};

        int i,j[3];
        int n = lua_gettop(L);

      for (i = 1; i <= n; i++){
        if (!lua_isnumber(L, i)){
           lua_pushstring(L, "incorrect argument");
           lua_error(L);
         }
          j[(i-1)] = lua_tonumber(L, i);

          printf("from stack %d\n",j[(i-1)]);
      }
        ML_GUI_DrawRectangle(j[1], j[2], j[3], &asvDrawColor);
}

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Jerome Vuarand
Sent: Thursday, July 30, 2009 8:59 PM
To: Lua list
Subject: Re: Newbie... trying to bring interactivity in C application using LUA...!!

2009/7/30 Subhash_Patil <Subhash_Patil@satyam.com>:
> I am trying to bring some interactivity to my c appliaction,
>
> To begin with, I am trying to draw a rectangle which is defined in Gui.c
> from LUA in my application Application_main.c.
>
> [...]
>
> Int Lua_main( void )
> {
>             int error;
>             lua_State *L = lua_open();   /* opens Lua */
>             luaL_Reg Creg;
>
>             lua_Integer n;
>             luaL_openlibs(L);
>
>             printf("luaL_openlibs\n");
>             lua_pushcfunction(L, SCSL_Draw_Rect(L));
>             printf("lua_pushcfunction\n");
>
> /*            n = 0;
>             lua_pushinteger(L, n);*/
>             n = 100;
>             lua_pushinteger(L, n);
>             n = 100;
>             printf("lua_pushinteger\n");
>             lua_pushinteger(L, n);
>             n = 300;
>             lua_pushinteger(L, n);
>             n = 300;
>             lua_pushinteger(L, n);
>             printf("lua_call\n");
>             lua_call( L, 5, 0);
>             printf("lua_call\n");
>             lua_close(L);
>
>             return 0;
> }
>
> I get all the prints in the Lua_main function. I see all the prints on the
> console but not the rectangle.
>
> Can you help me out in this regard.
>
> Thanks in advance.

You forgot to give us the content of SCSL_Draw_Rect.

Lua is not an acronym, you shouldn't capitalize it (see
http://www.lua.org/about.html#name).

Please send emails as plain text, not html, especially when you paste code.


DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.