New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reliance on plugin? #11
Comments
As it is it simply isn't possible from my understanding to take the ptr and get the data from it within lua since GUID is a value type and not a managed object. |
Thanks for the explanation. |
Yeah I get you. The source is in the repo but it'd be kinda hard to verify I didn't modify any of the like sol or lua files and then youd have to build it to make sure the dll matches or something idk. |
So, I was surprised this was actually impossible to do, and indeed you can't actually get a value type from a pointer right now in REFramework. BUT After some research into the lua layer source code, I found the REField:get_data() function can take a pointer as an argument, and so I managed to make the mod work with this piece of lua: local GuidType = sdk.find_type_definition("System.Guid")
local suidArg;
local function PreMsg(args)
suidArg = GuidType:get_field("mData1"):get_data(args[2]);
end |
Woah, that is sneaky! |
I'll see if I can make a pull request to the reframework book for that, if I can find a way to formulate that well. |
See Bolt-Scripts/MHR-InGame-ModMenu-API#11 , this is currently the only way to get fields from value type params in hooked functions
True, and I agree. |
I'm trying to figure out why this requires a native plugin before installing it. I'd like to avoid running precompiled dll's if it's not strictly necessary.
Could "PtrToGuidTest" not be expressed in lua? It seems you're able to set the value from lua. Is it too slow to do it like that?
The text was updated successfully, but these errors were encountered: