Skip to content

Instantly share code, notes, and snippets.

@amnn
Created November 28, 2022 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amnn/caaa5a9eb3175bae0e88601e3edb92a9 to your computer and use it in GitHub Desktop.
Save amnn/caaa5a9eb3175bae0e88601e3edb92a9 to your computer and use it in GitHub Desktop.
[package]
name = "Table Test"
version = "0.1.0"
[dependencies]
Sui = { ... }
[addresses]
std = "0x1"
sui = "0x2"
test = "0x0"
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