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

datatype macroquest: add BuildName #14

Merged
merged 1 commit into from Sep 18, 2022
Merged

datatype macroquest: add BuildName #14

merged 1 commit into from Sep 18, 2022

Conversation

martinlindhe
Copy link
Contributor

I also would like to ask about the new data types. How do they help, and what is the difference between eg. MQFloat and number (both are float?) and MQString and string (both are string?

@johnfking
Copy link
Contributor

MQString and the other new types are aliases not actually new datatypes. They are found in the alias.lua file. Many of the MQ primitives on datatypes look like members but are actually a function in Lua. Other MQ userdata types operate in two ways, often returning an object if called in the middle of a "dot train".. TLO.Me.Spawn. = > returns a spawn object whereas TLO.ME.Spawn() returns a string. To the Lua Language Server, there is no difference between Spawn and Spawn() so you have to write a definition that is spawn | fun(): string|nil, meaning this returns a spawn object, or a function that can return a string or nil. The aliases provide a way to capture this repeating pattern and just write it once.

@johnfking johnfking merged commit 4745805 into macroquest:master Sep 18, 2022
@martinlindhe martinlindhe deleted the buildname branch September 18, 2022 20:44
@martinlindhe
Copy link
Contributor Author

@johnfking Thanks, that makes alot of sense!

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.

None yet

2 participants