diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2023-05-06 22:53:40 +0100 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2023-05-06 22:53:40 +0100 |
commit | d951cb503f7d1c8e006f90c0954eb8e6bdbc3c92 (patch) | |
tree | f10e14f064ac3884fcd43656d0bcfcdad0e0c0b1 /src/value.rs | |
parent | bbd2488f798e79dd8997a199fd3ada7945b295d1 (diff) | |
download | mlua-d951cb503f7d1c8e006f90c0954eb8e6bdbc3c92.zip |
Add `Value::NULL` constant
Diffstat (limited to 'src/value.rs')
-rw-r--r-- | src/value.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/value.rs b/src/value.rs index 74834a9..2678e4b 100644 --- a/src/value.rs +++ b/src/value.rs @@ -63,6 +63,12 @@ pub enum Value<'lua> { pub use self::Value::Nil; impl<'lua> Value<'lua> { + /// A special value (lightuserdata) to represent null value. + /// + /// It can be used in Lua tables without downsides of `nil`. + pub const NULL: Value<'static> = Value::LightUserData(LightUserData(ptr::null_mut())); + + /// Returns type name of this value. pub const fn type_name(&self) -> &'static str { match *self { Value::Nil => "nil", |