Skip to content

Commit

Permalink
Change placeholder value to string singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
Ketasaja committed Oct 8, 2024
1 parent 9c6e2c0 commit 58e8de2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
9 changes: 6 additions & 3 deletions zap/src/output/luau/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ impl<'src> ClientOutput<'src> {

match ev.call {
EvCall::Polling => {
// Event types without data use `true` as a placeholder.
let name = ev.name;
self.push_line(&format!(
"table.insert(polling_payload_queues[{id}], if value == nil then true else value)"
"table.insert(polling_payload_queues[{id}], if value == nil then \"Zap placeholder value for dataless event \\\"{name}\\\"\" else value)"
));
}
_ => {
Expand Down Expand Up @@ -715,7 +715,10 @@ impl<'src> ClientOutput<'src> {
self.push_ty(&data);
self.push(")");
} else {
self.push("(() -> true)")
let name = ev.name;
self.push(&format!(
"(() -> \"Zap placeholder value for dataless event \"{name}\"."
));
}
self.push(",\n");
}
Expand Down
6 changes: 3 additions & 3 deletions zap/src/output/luau/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ impl<'a> ServerOutput<'a> {

if let EvCall::Polling = ev.call {
self.push_line(&format!("table.insert(polling_player_queues[{id}], player)"));
// Event types without data use `true` as a placeholder.
let name = ev.name;
self.push_line(&format!(
"table.insert(polling_payload_queues[{id}], if value == nil then true else value)"
"table.insert(polling_payload_queues[{id}], if value == nil then \"Zap placeholder value for dataless event \\\"{name}\\\"\" else value)"
));
} else {
if ev.call == EvCall::SingleSync || ev.call == EvCall::SingleAsync {
Expand Down Expand Up @@ -860,7 +860,7 @@ impl<'a> ServerOutput<'a> {
self.push_ty(&data);
self.push("))");
} else {
self.push("(() -> (Player, true)")
self.push("(() -> Player)")
}
self.push(",\n");
}
Expand Down
3 changes: 2 additions & 1 deletion zap/src/output/typescript/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ impl<'src> ClientOutput<'src> {
if let Some(data) = &ev.data {
self.push_ty(data);
} else {
self.push("true");
let name = ev.name;
self.push(&format!("\"Zap placeholder for event \\\"{name}\\\"\""));
}
self.push(";\n");
} else {
Expand Down
3 changes: 2 additions & 1 deletion zap/src/output/typescript/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ impl<'a> ServerOutput<'a> {
if let Some(data) = &ev.data {
self.push_ty(data);
} else {
self.push("true");
let name = ev.name;
self.push(&format!("\"Zap placeholder for event \\\"{name}\\\"\""));
}
self.push("];\n");
} else {
Expand Down

0 comments on commit 58e8de2

Please sign in to comment.