Neglecting a parameter with a similar punctuation in Lua in a type declaration #650
Unanswered
ProBaturay
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I often use a colon when defining a method instead of a dot with the type-checking engine. At first, I determine a table of functions with their types and pass on them. Here's an example of code for what I mean.
Both calls return the same value, except for the writing format. As aforementioned, I use the 2nd method as usual. I can reckon without the self parameter by using a colon, which I think is done with ease rather than using a dot and the parameter itself. But the type declaration sometimes does not comply with the same situation as the parentheses used for the predicted-to-be-passed parameters. Since Lua uses the keyword "self" to handle the hidden parameters, I guess there would be no specific keyword for Luau to get around with it. I propose something like this syntax that would get you to understand the state.
Understandably, I usually forget to write the table into the parentheses and struggle with debugging the script. The "->>" will see through the job hiding the self-behaving parameter. It will automatically search for the table that the function was assigned for. Such functions that are stored outside of a table will not be capable to use "->>" such that:
Please tell me whether there's anything I missed while glancing at the documents to get over it or if the idea itself is theoretically wrong. I appreciate any help!
Beta Was this translation helpful? Give feedback.
All reactions