Skip to content

Commit

Permalink
Merge pull request #5 from Sleitnick/bugfix/network-tuple
Browse files Browse the repository at this point in the history
Do not return tuple from network return
  • Loading branch information
Sleitnick authored Oct 17, 2022
2 parents 01c7ce7 + 4d42865 commit 31c5526
Show file tree
Hide file tree
Showing 6 changed files with 346 additions and 335 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Install dependencies
run: npm ci
- name: Publish project
run: npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# - name: Build for archive
# run: npm run build
- name: Create archive
shell: bash
run: |
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export namespace Network {
export const buy = new NetFunction<[item: string, category: string], [bought: boolean]>();

// Client gets sent multiple variables
export const getMultiple = new NetFunction<void, [msg1: string, msg2: string, msg3: string]>();
export const getMultiple = new NetFunction<void, {msg1: string, msg2: string, msg3: string}>();
}
```

Expand All @@ -157,7 +157,7 @@ Network.buy.server.handle((player, item, category) => {
return false;
});
Network.getMultiple.handle((player) => {
return ["hello", "world", "how are you"] as LuaTuple<[string, string, string]>;
return { msg1: "hello", msg2: "world", msg3: "how are you" };
});
```

Expand All @@ -169,7 +169,7 @@ Network.sendMessageToPlayer.client.connect((message) => {
});
Network.fireBullet.client.fire(new Vector3(), Vector3.zAxis);
const data = Network.getData.client.fire();
const [msg1, msg2, msg3] = Network.getMultiple.client.fire();
const { msg1, msg2, msg3 } = Network.getMultiple.client.fire();
```

## Lifecycles
Expand Down
Loading

0 comments on commit 31c5526

Please sign in to comment.