Skip to content

Commit

Permalink
Lua: Add uevr.api:to_uobject(uintptr_t)
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 19, 2024
1 parent d38c98a commit 5b1bb60
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lua-api/lib/src/ScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,15 @@ int ScriptContext::setup_bindings() {

m_lua.new_usertype<uevr::API>("UEVR_API",
"sdk", &uevr::API::sdk,
"to_uobject", [](sol::this_state s, uevr::API* api, uintptr_t addr) -> sol::object {
auto obj = (API::UObject*)addr;

if (obj == nullptr || !API::UObjectHook::exists(obj)) {
return sol::make_object(s, sol::lua_nil);
}

return sol::make_object(s, obj);
},
"find_uobject", [](sol::this_state s, uevr::API* api, const std::wstring& name) -> sol::object {
auto result = api->find_uobject<uevr::API::UObject>(name);

Expand Down

0 comments on commit 5b1bb60

Please sign in to comment.