-
Notifications
You must be signed in to change notification settings - Fork 331
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
New timer functions with lambdas #2843
Conversation
* Functions are now tables, containing parameter signature, return type and inner function * function:getParameterTypes() * function:getReturnType() * Don't reset global variables on `@strict`, fixing issue with top level locals not working as upvalues since they'd be reset by the runtime. I don't think this would actually affect anyone since you shouldn't be able to use variables before they're assigned, but it's `@strict` only behavior anyway.
I'd already fixed this bug with functions that have return values but this was not fixed for functions without return values. Also added a test case for this.
* Add tests to ensure variadic parameters, void parameters and implicit parameters aren't allowed * Fix lambdas potentially not returning at all codepaths like functions now are expected to do. Added a test for that.
* Ops will increase inside of the actual lambda's body instead of in ExprDynCall, which means it won't cost 0 ops to call them outside of an E2 chip. * Lambdas outside of E2 will now need to be called with ENT:Execute, which now optionally takes a "script" and "args" corresponding to what you'd pass to the lambda. It will handle perf and everything for you. * Remove Lambda:Call, UnsafeCall still exists in case someone wants to handle perf on their own in some extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be a limit to the number of timers created since they are implemented very inefficiently in the engine
E2 never had a timer limit though, I guess I could make it something large like 1k to avoid breaking things. |
I don't think |
This pull request has been marked as stale as there haven't been any changes in the past month. It will be closed in 15 days. |
it's over |
* Fix error when chip quotas with timers active * Make getTimers nodiscard, change deprecation message * Optimize code to not create / remove timers needlessly * Auto-remove timer with reps properly
15 ops to call lambda -> 10 ops
we're back |
Forgot to say, implemented as 100 per chip |
This is the only thing to be discussed, I was going to undeprecate it but now it's kind of odd since simple timers are leaking into the output since they use the same system... not sure if I like that so I kept it deprecated. Also the name is not very namespaced, so maybe could change this behavior and have a Need to implement |
This pull request has been marked as stale as there haven't been any changes in the past month. It will be closed in 15 days. |
Please don't let this die. |
Is this ready to be merged or should I fork it and continue on it myself? Just want |
This pull request has been marked as stale as there haven't been any changes in the past month. It will be closed in 15 days. |
This also changes the convention of lambdas being called from lua, now you need access to the E2 entity to call them. This could change since the context does store the actual chip entity on itself (
context.entity
)