YimMenuV2 icon indicating copy to clipboard operation
YimMenuV2 copied to clipboard

Implement Lua API

Open jhowkNx opened this issue 9 months ago • 30 comments

I know that you guys are working on this project from scratch, but here is my suggestion and support for lua scripts

jhowkNx avatar Mar 25 '25 17:03 jhowkNx

coming soon! and LSC tuning too!

CSY0N avatar Mar 30 '25 15:03 CSY0N

LSC Tuning Would be a great feature

Grim-Reaper-14 avatar Apr 02 '25 22:04 Grim-Reaper-14

Lets wait for maybegreat48 to cook i tried but im not pro like @maybegreat48 https://github.com/Mr-X-GTA/YimMenu/commit/03c1a96b67b75d8a5b25e2e0044aadd309b078ce 🫡❤️

L7NEG avatar Apr 04 '25 17:04 L7NEG

our patience might be rewarded <3

rayty24 avatar Apr 04 '25 20:04 rayty24

I'm sure this is still in the works, and I know you guys are busy with updates/patches/other open tickets. Just curious if there has been any movement with implementing the LUA API into V2? Or is this something that is going to take a while?

TwystedMind avatar Jun 04 '25 05:06 TwystedMind

I'm thinking of using WebAssembly for scripting instead of Lua. What are your opinions on this?

maybegreat48 avatar Jun 17 '25 05:06 maybegreat48

I think WebAssembly would be a lot harder to create scripts for and will cause a lot of scripts to be released without the source code.

tupoy-ya avatar Jun 17 '25 07:06 tupoy-ya

I'm thinking of using WebAssembly for scripting instead of Lua. What are your opinions on this?

From what I've researched it seems to be good, is there a demo/preview showing how it compares to lua?

jhowkNx avatar Jun 19 '25 00:06 jhowkNx

I think WebAssembly would be a lot harder to create scripts for

I don't think anyone will be writing GTA scripts in WebAssembly unless they either hate themselves or get aroused from pain and humiliation 😅 Most will just use Rust or TS then compile down but that means no source. I guess mbg could enforce one higher-level language and expect source code then compile it into WASM on load? But why do all that instead of just using that language? Basically the issue I have with this is if people start submitting only compiled .wasm blobs then we lose transparency and the whole spirit of open source that this community is built on.

xesdoog avatar Jun 21 '25 03:06 xesdoog

Lua is open source and human readable. Better. At all costs. Especially for gta 5 modding.

alzhetv avatar Jun 21 '25 15:06 alzhetv

I personally don't think most people will be using WASM for scripts, and most people will be likely confused due to being used to LUA scripts. I don't think this is good for end users nor developers.

WhoAboutYT avatar Jun 24 '25 20:06 WhoAboutYT

Do you want custom UIs using raw ImGui and the ability to hook arbitrary functions? Because that'll add a lot of complexity to the Lua implementation

maybegreat48 avatar Jun 25 '25 17:06 maybegreat48

Do you want custom UIs using raw ImGui?

That would be nice especially for those who like to introduce gameplay enhancements/rp elements to the game (wanna draw a custom fighter jet HUD? ImGui is your friend) but I agree that it'll add a lot of complexity and even double the time and effort it takes to finish the API but in the long run, it's totally worth it even for drawing the base UI of a script, you can create something totally different from the menu, which is nice. Why not start with basic bindings to get things up and running then add more stuff over time and as needed just like you guys did with the old API?

and the ability to hook arbitrary functions?

Never used that part of the old API because when it comes to actual skill-based game hacking, I'm a total monkey but I remember ShinyWasabi used that alot and released very good and useful Lua scripts so yes.

xesdoog avatar Jun 25 '25 18:06 xesdoog

There is a Lua script prototype now. More features and documentation will be added soon

maybegreat48 avatar Jun 25 '25 21:06 maybegreat48

Thank you for the update, I appreciate your hard work with implementing LuaJIT inside of it. Also, it seems like a great idea to make some type of ImGui menu API inside of the LUA enviornment / sandbox.

I also think it is a great idea to make hookfunctions / hooking arbitrary functions, however, I think that is something for later. Again, thanks for your hard work

WhoAboutYT avatar Jun 26 '25 01:06 WhoAboutYT

I appreciate your hard work with implementing LuaJIT inside of it.

Huh? Is it actually LuaJIT or Lua54?

xesdoog avatar Jun 26 '25 02:06 xesdoog

I appreciate your hard work with implementing LuaJIT inside of it.

Huh? Is it actually LuaJIT or Lua54?

Yes, it is luaJIT if you look inside of the recent commits, the CMake imports specify the LuaJIT implementations rather than lua5.4 implementations.

WhoAboutYT avatar Jun 27 '25 16:06 WhoAboutYT

A quick question/poll

Do you want Lua methods to look like set_invincible, setInvincible, or SetInvincible? For more context, our class names are PascalCase in C++, and our methods also use PascalCase, but snake_case might be more idiomatic Lua. We don't use camelCase anywhere right now, but added it for completeness

This can't be changed once Lua support officially releases

maybegreat48 avatar Jun 28 '25 13:06 maybegreat48

A quick question/poll

Do you want Lua methods to look like set_invincible, setInvincible, or SetInvincible?

This can't be changed after Lua officially releases

I vote for setInvincible.

WhoAboutYT avatar Jun 28 '25 13:06 WhoAboutYT

I vote snake case.

xesdoog avatar Jun 28 '25 14:06 xesdoog

I vote Set_Invincible

Grim-Reaper-14 avatar Jun 28 '25 14:06 Grim-Reaper-14

I vote setInvincible.

TwystedMind avatar Jun 28 '25 15:06 TwystedMind

A quick question/poll

Do you want Lua methods to look like set_invincible, setInvincible, or SetInvincible? For more context, our class names are PascalCase in C++, and our methods also use PascalCase, but snake_case might be more idiomatic Lua. We don't use camelCase anywhere right now, but added it for completeness

This can't be changed once Lua support officially releases

idk anything about coding or whatever but since set invincible is winning ill vote setinvincible

rayty24 avatar Jun 28 '25 17:06 rayty24

I personally think setInvincible should be chosen rather than the other options because camel case is the preferred lua casing for functions and variables. Though Lua and Python have the same human-readable syntax, coding standards should still be put into place and camel case should be chosen imo. I am mentioning Python because snake-case was mentioned inside of this post.

WhoAboutYT avatar Jun 28 '25 18:06 WhoAboutYT

I personally think setInvincible should be chosen rather than the other options because camel case is the preferred lua casing for functions and variables.

Snake case is preferred by most lua projects, not camel case

maybegreat48 avatar Jun 28 '25 18:06 maybegreat48

because camel case is the preferred lua casing for functions and variables

Nope. Snake case is the most commonly used naming convention for both Lua and Python. In your code you're free to use any style you want (and you should, to distinguish your user-defined variables/methods from built in ones). Lower camel case is comonly used in JS and doesn't make sense here so I recommend we either stick with the menu's style (upper camel case) or use the regular Lua style (snake case).

xesdoog avatar Jun 28 '25 18:06 xesdoog

umm is it wrong if i ask can i use the lua menu or rather where to find the usable lua scripts

AnikSingha12 avatar Jun 30 '25 00:06 AnikSingha12

umm is it wrong if i ask can i use the lua menu or rather where to find the usable lua scripts

LUA support is still in the process of being implemented, hence the reason it's being asked which case format everyone prefers. There are no usable scripts for V2 as of yet.

TwystedMind avatar Jun 30 '25 17:06 TwystedMind

umm is it wrong if i ask can i use the lua menu or rather where to find the usable lua scripts

LUA support is still in the process of being implemented, hence the reason it's being asked which case format everyone prefers. There are no usable scripts for V2 as of yet.

Aaaaaaahhhh no wonder why scripts won't work thanks for enlighten me

rayty24 avatar Jun 30 '25 18:06 rayty24

Aaaaaaahhhh no wonder why scripts won't work thanks for enlighten me

If you tried to run a script from legacy YimMenu then it won't work even when this API is finished because it's different which means scripts are not compatible between the two menus even if they only call a few natives. There's still room to make some kind of cross-compatibility by renaming some class methods to match the old API like run_in_callback vs run_in_fiber but that takes time and mbg has done more than enough at this point. Lua devs will have to write their own compatibility layers to detect the environment and adjust their code to work for both APIs since they already have to adjust for game versions when writing cross-compatible scripts.

xesdoog avatar Jun 30 '25 20:06 xesdoog