lua-users home
lua-l archive

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


Hallo,

On Mon, Aug 16, 2010 at 4:13 PM, Peyman <peiman_3009@yahoo.com> wrote:
>
> this is quote from most of APIs in MSDN :
> "If the function succeeds, the return value is nonzero."
>
> so in most of api return value is zero or nonzero so this is easy to check it in a if statement for my interpreter.
>

static int function_wrapper(lua_State* L)
{
   int ret;
   /* get args ... */

   ret = wrappedMSFunction(...);
   if(ret == 0) {
      lua_pushboolean(L, 0);
   } else {
      lua_pushinteger(L, ret);
   }
}

--
-alex
http://www.artisancoder.com/