Open ab9rf opened 2 months ago
so the conclusion i've come to while poking around this issue is, because we can only store a pointer to executable code in a vtable, implementing this will require the ability to create new code at runtime so that a pointer to that code can be inserted into the vtable. this isn't impossible, of course, but it requires special consideration (e.g. mprotect
in linux, VirtualProtect
in Windows). so this won't be a trivial implementation
basically implement some mechanic such that a vmethod interpose can be implemented in Lua instead of C++
this would facilitate modders doing things that can be done by vmethod interpose without having to dive deep into C++ to do it, which would benefit development velocity of new ideas. obviously this shouldn't be used for high-frequency vmethods due to performance concerns, but if someone comes up with a good idea with a Lua interpose that presents a performance concern, we can always reimplement in native code