summaryrefslogtreecommitdiff
path: root/src/stdlib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib.rs')
-rw-r--r--src/stdlib.rs26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/stdlib.rs b/src/stdlib.rs
index fb0f1b8..34c7629 100644
--- a/src/stdlib.rs
+++ b/src/stdlib.rs
@@ -8,12 +8,19 @@ pub struct StdLib(u32);
impl StdLib {
/// [`coroutine`](https://www.lua.org/manual/5.4/manual.html#6.2) library
///
- /// Requires `feature = "lua54/lua53/lua52"`
- #[cfg(any(feature = "lua54", feature = "lua53", feature = "lua52"))]
+ /// Requires `feature = "lua54/lua53/lua52/luau"`
+ #[cfg(any(
+ feature = "lua54",
+ feature = "lua53",
+ feature = "lua52",
+ feature = "luau"
+ ))]
pub const COROUTINE: StdLib = StdLib(1);
/// [`table`](https://www.lua.org/manual/5.4/manual.html#6.6) library
pub const TABLE: StdLib = StdLib(1 << 1);
/// [`io`](https://www.lua.org/manual/5.4/manual.html#6.8) library
+ #[cfg(not(feature = "luau"))]
+ #[cfg_attr(docsrs, doc(cfg(not(feature = "luau"))))]
pub const IO: StdLib = StdLib(1 << 2);
/// [`os`](https://www.lua.org/manual/5.4/manual.html#6.9) library
pub const OS: StdLib = StdLib(1 << 3);
@@ -21,28 +28,32 @@ impl StdLib {
pub const STRING: StdLib = StdLib(1 << 4);
/// [`utf8`](https://www.lua.org/manual/5.4/manual.html#6.5) library
///
- /// Requires `feature = "lua54/lua53"`
- #[cfg(any(feature = "lua54", feature = "lua53"))]
+ /// Requires `feature = "lua54/lua53/luau"`
+ #[cfg(any(feature = "lua54", feature = "lua53", feature = "luau"))]
pub const UTF8: StdLib = StdLib(1 << 5);
/// [`bit`](https://www.lua.org/manual/5.2/manual.html#6.7) library
///
- /// Requires `feature = "lua52/luajit"`
- #[cfg(any(feature = "lua52", feature = "luajit", doc))]
+ /// Requires `feature = "lua52/luajit/luau"`
+ #[cfg(any(feature = "lua52", feature = "luajit", feature = "luau", doc))]
pub const BIT: StdLib = StdLib(1 << 6);
/// [`math`](https://www.lua.org/manual/5.4/manual.html#6.7) library
pub const MATH: StdLib = StdLib(1 << 7);
/// [`package`](https://www.lua.org/manual/5.4/manual.html#6.3) library
+ #[cfg(not(feature = "luau"))]
+ #[cfg_attr(docsrs, doc(cfg(not(feature = "luau"))))]
pub const PACKAGE: StdLib = StdLib(1 << 8);
/// [`jit`](http://luajit.org/ext_jit.html) library
///
/// Requires `feature = "luajit"`
#[cfg(any(feature = "luajit", doc))]
+ #[cfg_attr(docsrs, doc(cfg(feature = "luajit")))]
pub const JIT: StdLib = StdLib(1 << 9);
/// (**unsafe**) [`ffi`](http://luajit.org/ext_ffi.html) library
///
/// Requires `feature = "luajit"`
#[cfg(any(feature = "luajit", doc))]
+ #[cfg_attr(docsrs, doc(cfg(feature = "luajit")))]
pub const FFI: StdLib = StdLib(1 << 30);
/// (**unsafe**) [`debug`](https://www.lua.org/manual/5.4/manual.html#6.10) library
pub const DEBUG: StdLib = StdLib(1 << 31);
@@ -52,7 +63,10 @@ impl StdLib {
/// (**unsafe**) All standard libraries
pub const ALL: StdLib = StdLib(u32::MAX);
/// The safe subset of the standard libraries
+ #[cfg(not(feature = "luau"))]
pub const ALL_SAFE: StdLib = StdLib((1 << 30) - 1);
+ #[cfg(feature = "luau")]
+ pub const ALL_SAFE: StdLib = StdLib(u32::MAX);
pub fn contains(self, lib: Self) -> bool {
(self & lib).0 != 0