lua-users home
lua-l archive

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


>I have made a translation of lua header for pascal and I have a problem for 
>converting the macro luaL_putchar.
>I don't what it does exactly. Anyone can tell me what it does or where I can 
>found a documentation about it.

Here is the definition of luaL_putchar:

#define luaL_putchar(B,c) \
  ((void)((B)->p < &(B)->buffer[LUAL_BUFFERSIZE] || luaL_prepbuffer(B)), \
   (*(B)->p++ = (char)(c)))

This translates to
	if ((B)->p >= &(B)->buffer[LUAL_BUFFERSIZE]) luaL_prepbuffer(B);
	*(B)->p++ = (char)(c);

In words:
   add c to the buffer, calling luaL_prepbuffer first, if the buffer is full.

Perhaps you'll need to turn luaL_putchar into a function with the body above
and export this function to Pascal.
--lhf