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

Clarify Lua metamethod usage for some classes; Minor docs edits #376

Merged
merged 1 commit into from
Feb 11, 2024

Conversation

Lyrth
Copy link
Contributor

@Lyrth Lyrth commented Feb 10, 2024

Resolves #374

  • Clarified usage of __index, __newindex, __call in multiple classes, placing them in a separate Metamethods category.
  • Added __len metamethod description for TArray.
  • UFunction __call: mention return val and specify the need for a context parameter if not part of an object instance.
  • UObject __index: added example of a UFunction call.
  • UObject type(): clarify that type(object) is not equivalent.
  • Minor edits (spelling)

For initial review.

@UE4SS UE4SS self-requested a review February 10, 2024 13:02
Copy link
Collaborator

@UE4SS UE4SS left a comment

Choose a reason for hiding this comment

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

I have requested a bunch of changes where the syntax is wrong but the casing is also wrong in most places.

In general, I believe we're using PascalCase for variable names in the docs and UECase for UE types, and where appropriate the UE type without the type.
Meaning that if the UE type is UFunction and if you're referring to the type then put use UFunction never ufunction, but if you're referring perhaps to the general concept of a function then Function would be fine.
I know we're a bit inconsistent with this, the UObject docs for example has this: CallFunction(UFunction function, auto Params...) and ideally "f" should've been "F" for the first param.

docs/lua-api/classes/uobject.md Outdated Show resolved Hide resolved
docs/lua-api/classes/uobject.md Outdated Show resolved Hide resolved
docs/lua-api/classes/uobject.md Outdated Show resolved Hide resolved
docs/lua-api/classes/uobject.md Outdated Show resolved Hide resolved
docs/lua-api/classes/uscriptstruct.md Outdated Show resolved Hide resolved
docs/lua-api/classes/uscriptstruct.md Outdated Show resolved Hide resolved
@Lyrth
Copy link
Contributor Author

Lyrth commented Feb 10, 2024

I have requested a bunch of changes where the syntax is wrong but the casing is also wrong in most places.

As for the indexing syntax changes, I originally intended for it to show passing in a string variable as the index (as opposed to passing in a string literal, hence the different casing and name, e.g. structMemberVarName variable vs. StructMemberName literal on the second usage).

Although on second thought, a string literal would be less confusing and better overall as it also implies that the index is a string value in general. I will make changes to those usages.

I will also make changes to the casing of the variables, e.g. ufunction(...) -> UFunction(...), and probably for ones with __index too, as in object[objectMemberVarName] = newValue -> UObject["ObjectMemberName"] = NewValue, unless the former's currently fine.

@UE4SS
Copy link
Collaborator

UE4SS commented Feb 10, 2024

I have requested a bunch of changes where the syntax is wrong but the casing is also wrong in most places.

As for the indexing syntax changes, I originally intended for it to show passing in a string variable as the index (as opposed to passing in a string literal, hence the different casing and name, e.g. structMemberVarName variable vs. StructMemberName literal on the second usage).

Although on second thought, a string literal would be less confusing and better overall as it also implies that the index is a string value in general. I will make changes to those usages.

I will also make changes to the casing of the variables, e.g. ufunction(...) -> UFunction(...), and probably for ones with __index too, as in object[objectMemberVarName] = newValue -> UObject["ObjectMemberName"] = NewValue, unless the former's currently fine.

All your proposed changes look good.

@Lyrth
Copy link
Contributor Author

Lyrth commented Feb 11, 2024

  • Applied changes
  • Fixed UObject:CallFunction param casing (UFunction function -> UFunction Function)

@Buckminsterfullerene02 Buckminsterfullerene02 merged commit 36eae9d into UE4SS-RE:main Feb 11, 2024
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.

Clarify the usage of metamethods in the Lua API docs
3 participants
  翻译: