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

Lua API Convenience changes #451

Merged
merged 2 commits into from
Jul 13, 2022
Merged

Lua API Convenience changes #451

merged 2 commits into from
Jul 13, 2022

Conversation

Strackeror
Copy link
Contributor

@Strackeror Strackeror commented Jul 12, 2022

This adds 2 things for convenience with lua scripts:

  • Include the coroutine library, I really don't see a reason not to include it, it can make some things really convenient, though it's a bit weird to use.

  • Indexing methods for REManagedObject This allows writing lua a bit more like you're using the REManagedObject directly in the script. Colon syntax even works correctly !

Examples

-- method call
obj:call("handleThing", true, 1)
-- can be written as
obj:handleThing(true, 1)

-- field call
local a = obj:get_field("val1")
-- can be written as
local a = obj.val1

-- field assignement
obj:set_field("val1", 1)
-- can be written as
obj.val1 = 1

@praydog praydog merged commit 7a81655 into praydog:master Jul 13, 2022
@praydog
Copy link
Owner

praydog commented Jul 13, 2022

Awesome, I just tried it out and all the old scripts still seem to work as normal, and the new syntax looks and works great.

Thanks for the PR!

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.

2 participants