Created
November 28, 2022 14:41
-
-
Save amnn/caaa5a9eb3175bae0e88601e3edb92a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "Table Test" | |
version = "0.1.0" | |
[dependencies] | |
Sui = { ... } | |
[addresses] | |
std = "0x1" | |
sui = "0x2" | |
test = "0x0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module test::test { | |
use sui::table; | |
use sui::tx_context::TxContext; | |
public entry fun test(ctx: &mut TxContext) { | |
let t = table::new<u64, u64>(ctx); | |
table::add(&mut t, 1, 2); | |
let v = table::remove(&mut t, 1); | |
table::add(&mut t, 2, v); | |
table::drop(t); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment