Skip to content
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

Lua API improvements + direct UEVR integration #255

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open

Conversation

praydog
Copy link
Owner

@praydog praydog commented Jun 17, 2024

Important additions

  • Added LuaLoader to UEVR menu, scripts can be loaded from <config folder>/scripts/*.lua

Lua API improvements

Properties can now be accessed and set

  • Boolean, integer, floating point properties
  • FName, UObject properties
  • Array properties (getter only, of UObject* elements)

TODO: StructProperty (vectors etc), ClassProperty, ByteProperty, EnumProperty

Functions can now be called on objects

ex:

local game_engine_class = uevr.api:find_uobject("Class /Script/Engine.GameEngine")
local game_engine = UEVR_UObjectHook.get_first_object_by_class(game_engine_class)
local game_instance = game_engine.GameInstance
local local_players = game_instance.LocalPlayers
local player = local_players[1]
local player_controller = player.PlayerController
local pawn = player_controller.Pawn

local lifespan = pawn:GetLifeSpan() -- function calling with return values
pawn:SetLifeSpan(lifespan + 1.0) -- function calling with arguments
  • Boolean, integer, floating point parameters
  • FName, UObject parameters

TODO: StructProperty (vectors etc), Array parameters, out parameters, ByteProperty, EnumProperty

@praydog praydog self-assigned this Jun 17, 2024
const auto desc = c->find_property(name.c_str());

if (desc == nullptr) {
return;
Copy link
Contributor

@mrbelowski mrbelowski Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these early returns log something to help the script developer? If the property / class isn't found (typo, wrong path, whatever) then the failing set_property call might go unnoticed

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I can add a throw

Copy link
Contributor

@mrbelowski mrbelowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@praydog praydog linked an issue Jun 25, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] for more info regarding the UEVR Lua API
2 participants