Skip to content

Fix OOP definitions to return vectors for listed APIs - #5075

Merged
FileEX merged 6 commits into
multitheftauto:masterfrom
QueryOfficial:fix/oop-vector-return-defs
Aug 15, 2026
Merged

FileEX merged 6 commits into
multitheftauto:masterfrom
QueryOfficial:fix/oop-vector-return-defs

Conversation

@QueryOfficial

Copy link
Copy Markdown

Summary

Wire OOP method/property getters (and matching Vector setters where needed) so the APIs listed in #1583 return Vector2/Vector3 instead of multiple floats.

Procedural functions (e.g. getObjectScale, guiGetPosition, getRadarAreaSize) are unchanged and still return floats.

Examples:

-- procedural (unchanged)
local x, y, z = getObjectScale(obj)

-- OOP (now returns a vector)
local scale = obj:getScale()
local scale2 = obj.scale

Covered (client/server as applicable): RadarArea size, Object scale, Ped muzzle position, Light direction, Vehicle turret/respawn, Water vertex position, GUI position/size/nativeSize, TextItem position.

Skipped: server getCameraMatrix (incomplete stub), server PointLight (does not exist).

Motivation

Several OOP definitions incorrectly returned multiple floats (or were missing vector OOP wiring), so :getX() / .x did not match the expected vector OOP semantics.

Fixes #1583.

Test plan

  1. Build client and server; confirm the changed luadefs compile cleanly.
  2. Client: for Object/Ped/Light/Vehicle/RadarArea/Water/GUI, verify procedural calls still return floats, while OOP :get*() / .* return Vector types; for GUI also verify .position / .size assign with Vector2.
  3. Server: for Vehicle turret/respawn, RadarArea size, TextItem position, and Water vertex position, verify the same procedural-vs-OOP split.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Comment thread Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp Outdated
@FileEX FileEX added backwards-incompatible Should be merged after the release of 1.7.1 bugfix Solution to a bug of any kind labels Jul 23, 2026
@FileEX FileEX added this to the 1.7 (Current) milestone Jul 23, 2026

@sbx320 sbx320 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To avoid backwards incompatibility, this should use lua_ncallresult.

For example see https://github.com/multitheftauto/mtasa-blue/blob/master/Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp#L1054

Keep multi-assign float returns for backwards compatibility while
single-result/property access still returns Vector2/Vector3.
@QueryOfficial

Copy link
Copy Markdown
Author

To avoid backwards incompatibility, this should use lua_ncallresult.

For example see https://github.com/multitheftauto/mtasa-blue/blob/master/Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp#L1054

Thanks, applied. OOP getters now use lua_ncallresult so multi-assign still returns floats, while single/property access returns a vector.

Comment thread Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp Outdated
Batuhan Tonga added 2 commits August 7, 2026 22:35
Updated OOP methods across various classes to utilize ArgumentParser for handling vector returns. This change maintains backward compatibility by ensuring that multi-assign float returns are preserved while transitioning to a more robust argument parsing mechanism. Adjustments were made to methods related to GUI elements, objects, vehicles, and radar areas, ensuring consistent behavior in Lua interactions.
@FileEX FileEX removed the backwards-incompatible Should be merged after the release of 1.7.1 label Aug 14, 2026
@FileEX
FileEX enabled auto-merge (squash) August 14, 2026 01:15
@FileEX

FileEX commented Aug 15, 2026

Copy link
Copy Markdown
Member

Wait until @sbx320 approves it.

@FileEX
FileEX merged commit 7f28b3b into multitheftauto:master Aug 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some OOP definitions are incorrect

3 participants