On Thu 26. May 2005 10:49, Steve Donovan wrote: > This is a hack, I fear. The good news is that Lua can call > external code in DLLs using loadlib(). The bad news is the > function returned by loadlib() doesn't accept any parameters. > So one has to copy the parameters to a temporary file, > call the function in the DLL, which writes to another temporary > file, which we then read. First thing to check is whether > the scite_other.dll has actually been loaded - it > should complain. > > steve d. >
LUA CAN call functions with arguments in external dll/so libraries. loadlib requires one function to initialize and bind the rest of the functions in the dll/so to LUA This function is not ment to execute any code apart from binding new functions to LUA so it does not require any arguments. To bind functions to LUA without the pain of writing the biding code yourself. SEE: http://www.codenix.com/~tolua/ its a utility to automaticaly generate binding code from cleaned header files. peter d. > >>> [EMAIL PROTECTED] 05/26/05 1:37 AM >>> > > Steve Donovan wrote: > > Ah, the file wasn't opened successfully, so f was null. > > I really should be more careful about these things! > > No problem. I'm still a very new Lua user. Would you mind expanding > on what exactly TEMP_FILE_IN and TEMP_FILE_OUT are used for in this > code? How do I use this with Scite? > > Thanks a lot! > > >>>>[EMAIL PROTECTED] 05/24/05 3:39 AM >>> > > > > What is wrong with the following Lua function? This is taken from > > "scite_other.lua" by Steve Donovan. I marked the error line in the > > code below. The error message is: > > > > attempt to index local `f' (a nil value) > > > > > > function Perform(verb,arg,other) > > local f = io.open(TEMP_FILE_IN,'w') > > if not arg then > > arg = '' > > else > > -- exec is a special verb _not_ handled by the Director interface, > > -- which otherwise requires its input to be slashified. > > if verb ~= 'exec' then > > arg = string.gsub(arg,'\\','\\\\') > > end > > end > > local cmd = 1 > > if other then cmd = 0 end > > f:write(verb,':',arg,'\n') > > f:write(cmd,' ',our_window,'\n') > > f:close() > > fn() > > f = io.open(TEMP_FILE_OUT,'r') > > local n = f:read('*n') -- < error here > > f:read() > > if n == 1 then > > our_window = f:read() > > end > > end _______________________________________________ Scite-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scite-interest
