As the title says... Chat on...

User avatar
By alonewolfx2
#9637 i am porting pcd8544 driver in to the lua. i need to catch and print messages.how can i catch ? any help is welcome
Code: Select allstatic int pcd8544_write( lua_State* L)
{
   int x, y;
  if ( lua_isnumber(L, 1) )
    {
     x = lua_tointeger(L, 1);
      y = lua_tointeger(L, 2);
  PCD8544_gotoXY(x,y);
//static "msg" word printing successufully
//but i need to catch from lua
  PCD8544_lcdPrint("msg");
    }
  return 0;
}
User avatar
By alonewolfx2
#9692 here is answer

Code: Select allstatic int pcd8544_print( lua_State* L )
{
   int x,y;
   x= lua_tointeger(L, 1);
   y= lua_tointeger(L, 2);

  size_t length;
   const char *buffer = luaL_checklstring(L, 3, &length);
   PCD8544_gotoXY(x,y);
       // Put text in Box
   while (*buffer) {
       PCD8544_lcdCharacter(*buffer++);
     }
  return 1;
}