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

alt.Vehicle constructor without parameters doesn't throw error (v1 compat) #196

Open
xxshady opened this issue Feb 22, 2024 · 5 comments
Open
Assignees

Comments

@xxshady
Copy link
Collaborator

xxshady commented Feb 22, 2024

alt.log(1)
new alt.Vehicle()
alt.log(2)

image

@xLuxy
Copy link
Contributor

xLuxy commented Mar 4, 2024

Fixed in dev/0.0.0-dev.25 (see 8222ae0)

@xLuxy xLuxy closed this as completed Mar 4, 2024
@xxshady
Copy link
Collaborator Author

xxshady commented Mar 4, 2024

still happens

image

@xLuxy xLuxy reopened this May 25, 2024
@xLuxy xLuxy added type: bug Something isn't working and removed status: fixed labels May 25, 2024
@Yiin
Copy link
Contributor

Yiin commented Aug 12, 2024

Because both v2 and compatibility uses the same factory class for entities it's not fixable.

alt.*.create calls constructor with no args internally to create the object.

There is no sane way to check if the constructor is called using alt.*.create or new alt.*, hence we don't know if the constructor was called internally when using alt.*.create or if it was called directly using new alt.*.

@xxshady
Copy link
Collaborator Author

xxshady commented Aug 12, 2024

there is at least one way to check

@xxshady
Copy link
Collaborator Author

xxshady commented Aug 12, 2024

its fixable by setting prototype in this call instead of calling NewInstance, but we won't change (at least for now) it as it would break factory API

upd: seems like its better to use v8::Object::New and pass prototype there instead of directly changing prototype (see warning)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants