Quote from: AJA on Sat 28/07/2012 20:25:50Oh, yes, that too. It should at least be possible to convert any script module to Lua, and I did start work on a tool to automatically convert any piece of AGS script to equivalent Lua code to help with that.
Plus you can't call modules or plugins from Lua.
For plugins though... well, it migbt be possible to one day achieve this, but it would take quite a bit of work:
- I have no idea if the GetScriptFunctionAddress() works with plugin-imported functions, obviously that has to be the case
- In order to call arbitrary C/C++ functions that are not known to the runtime plugin compiler at compile-time, the Lua plugin would need to use a special FFI library like libffi. (I haven't tried this before, I'm not sure how much work it would be, or how cross-platform.)
- In order to find the other plugin's function signatures, the AGS script headers would need to be parsed and processed to extract them. (Luckily there is the C# module "SPAGS" I made that should help with doing stuff like that, though.)
Quote from: AJA on Sat 28/07/2012 20:25:50
Btw, I'm not sure whether it's AGS or this plugin but it takes quite a while to save a game in Barely Floating (see GiP thread for game info). If AGS saves a screenshot regardless of whatever the game settings are, then it might be AGS. But just as a heads up, if the plugin saving is in any way a slow operation, you might want to add some AGS system polling calls in there because the sound stutters whenever I save a game.
There is certainly a bit of processing going on when it serializes the Lua state. Part of the problem is I've never had a realistically large real-world test case project myself to experiment with, so it's quite possible you're seeing it under more strain than I ever have. I will certainly look into good places to put some PollSystem() calls, anyway.
Quote from: AJA on Sat 28/07/2012 20:25:50While checking up on the documentation in reply to this I just noticed the GetGameOptions() function in the plugin API that I somehow missed before, so for game options it seems like it should be possible to write those wrapper functions! Sorry for not spotting that before. I'll put that on the todo list.
And what exactly is the problem with fields? Can't you just write wrapper functions to access them? Or is there no way to access them through the plugin API?
(In general though, there's no documented way to access them. Admittedly, I am already working with undocumented things in the plugin API, like using "GetScriptFunctionAddress" to get the addresses of variables rather than functions, and the odd way that "float" values are passed around internally as function parameters/return values in AGS. For both of those I was using information I found posted on the technical forum, so it was already kind of unofficially established, but I couldn't find anything about struct fields.)