From 45159bfda7267d809c8fb4fe8b6be65f2a1763bd Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Sat, 28 Sep 2019 15:22:13 +0100 Subject: [PATCH] Add Table::raw_remove method --- src/table.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/table.rs b/src/table.rs index 3585853..8227d6a 100644 --- a/src/table.rs +++ b/src/table.rs @@ -132,6 +132,13 @@ impl<'lua> Table<'lua> { } } + /// Removes a key from the table, returning the value at the key + /// if the key was previously in the table. + pub fn raw_remove>(&self, key: K) -> Result<()> { + self.raw_set(key, Nil)?; + Ok(()) + } + /// Sets a key-value pair without invoking metamethods. pub fn raw_set, V: ToLua<'lua>>(&self, key: K, value: V) -> Result<()> { let lua = self.0.lua;