well, i pretty much got the headers to work with D4, the only real problem were two undeclared sysutils funcs which i copied from D7 RTL, also D4 has no varargs (unless you count quake 2 delphi pas asm sprintf implementation as one )

so basicly i got it to work by doing this:

simply uncommenting varargs here:
function lua_pushfstring(L: Plua_State; const Fmt: PChar): PChar;// varargs;
cdecl external 'lua.dll';

and here:
function luaL_error(L: Plua_State; const Fmt: PChar): Integer; //varargs;
cdecl external 'lua.dll';

basicly, thats the only thing i can do in D4, since i can't make use of those funcs because d4 has no varargs support in compiler.

and i copied these two funcs from D7 RT into luautils.pas:

function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string;
function AnsiDequotedStr(const S: string; AQuote: Char): string;

and now it pretty much works fine in D4, i just had to do some manual converting of DFM files into d4 format, for example, it does not like the widechars being declared for a widestring, like #2342#2131, so i had to clear all those, and then convert them to D4 binary format.