Originally Posted by
Robert Kosek
I updated the Lazarus project though I am not using that directly, just using straight FPC instead. It might be my register function for the CRT "library" but I really don't know. You can get the whole project
from here. What'd I do this time? :?
Also, I noticed numerous errors in my functions and the IFDEF clause the newer definition in the source is much better.
EDIT:
This is screwy. It's telling me that it doesn't want a pointer/address to the function, then I remove the @ symbol it immediately complains of too few arguments. What's going on!? This doesn't even raise an error in the LuaCRT unit, but in the main one it does. :?
Is there something wrong with those register methods? They were the only really simple way to register the functions to a table that I could find. The way you gave me before FPC couldn't find the needed function. :?
EDIT: You mean to try the RegisterMethod from LuaObject.pas? So, I should just use that instead I guess. Though, I honestly don't understand the duplicity and frequency of so many functions to try and do that same thing.
EDIT2: As in something like this to register my functions?[pascal]procedure RegisterCRT(L: PLua_State);
var
idx : Integer;
begin
lua_pushliteral(L, 'crt');
lua_newtable(L);
idx := lua_gettop(L);
RegisterMethod(L, 'KeyPressed', @lua_KeyPressed, idx);
RegisterMethod(L, 'ReadKey', @lua_ReadKey, idx);
RegisterMethod(L, 'GetXY', @lua_GetXY, idx);
RegisterMethod(L, 'TextColor', @lua_TextColor, idx);
RegisterMethod(L, 'BackgroundColor', @lua_BackgroundColor, idx);
RegisterMethod(L, 'ClrScr', @lua_ClrScr, idx);
RegisterMethod(L, 'ClrEol', @lua_ClrEol, idx);
RegisterMethod(L, 'DelLine', @lua_DelLine, idx);
RegisterMethod(L, 'GotoXY', @lua_GotoXY, idx);
RegisterMethod(L, 'InsLine', @lua_InsLine, idx);
RegisterMethod(L, 'Window', @lua_Window, idx);
// lua_settable(L,idx);
lua_settable(L, LUA_GLOBALSINDEX);
end;[/pascal]Attempting that immediately gave me this when attempting to compile:
Code:
LuaObject.pas(462,49) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(463,55) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(464,46) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(465,43) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(466,46) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(467,43) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(484,49) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(485,55) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(487,43) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(488,46) Error: Incompatible type for arg no. 3: Got "<address>", expected "<procedure>"
LuaObject.pas(516) Fatal: There were 10 errors compiling module, stopping
LuaObject.pas(4,50) Fatal: Compilation aborted
Ick; at the moment I'm reconsidering trying to learn Lua using FPC. FPC just isn't very friendly to me no matter what I do, whenever I try.
Bookmarks