-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add polling #136
Add polling #136
Conversation
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.
Thanks for this!
I started by reviewing general code stuff. I'll let @jackdotink review first and then I'll go through and test the output locally.
Instead of adding a new event field I added I need to make the global option configure the default |
I think in a rewrite or in the future in general, Zap should report an error and exit immediately when one is encountered. |
The reason why we did that is for error recovery I think. It would make it much eaisier for stuff like building an LSP etc |
zap/src/output/luau/client.rs
Outdated
// Event types without data use `true` as a placeholder. | ||
self.push_line(&format!( | ||
"table.insert(polling_payload_queues[{id}], if value == nil then true else value)" | ||
)); |
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.
if true is being used as a placeholder, then what happens to real true values? I recommend we use some "null" userdata to represent nil
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.
Or maybe we use a counter for events w/o data instead of an array - sorta like how it works already for queuing
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.
Or maybe we use a counter for events w/o data instead of an array - sorta like how it works already for queuing
Something needs to be returned to the loop or iteration will end, there's no player to return on the client.
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.
if true is being used as a placeholder, then what happens to real true values? I recommend we use some "null" userdata to represent nil
I don't see much benefit to this unless you assign a metatable that errors on everything, but you don't like metatables. I could make this change though.
for meaningless_value in event do
if meaningless_value then
-- Same behavior either way.
end
end
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.
You'd also need to lie to the type system because newproxy(true)
returns any
, which would be worse than true
.
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.
we need to do something because if we use true
then boolean?
becomes impossible
I changed the placeholder value to an explanatory string literal because I don't think a for meaningless_value in event do
if meaningless_value then
-- Same behavior whether `meaningless_value` is a `newproxy` userdata or not.
end
end I can change this if necessary. |
Does it matter that |
I'd also prefer we didn't use a string singleton. |
If you want the change to userdata with that said, I'll make it, but I think a string singleton is the least wrong option. |
* |
As discussed with @jackdotink - I think this PR is overcomplicated and has a ton of merge conflicts. We'd still be open to a new implimentation, though! |
call_default
.EvCall:Polling
variant.