mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-10 01:10:30 +00:00
Use "require" in textutils
This avoids us having to support requireless environments inside cc.strings. I do kinda wonder if os.loadAPI-loaded files should also have their own shared "require", just so we're not loading 10 copies of cc.expect.
This commit is contained in:
parent
4bfb9ac323
commit
63185629b7
@ -7,9 +7,13 @@
|
||||
-- @module textutils
|
||||
-- @since 1.2
|
||||
|
||||
local expect = dofile("rom/modules/main/cc/expect.lua")
|
||||
local pgk_env = setmetatable({}, { __index = _ENV })
|
||||
pgk_env.require = dofile("rom/modules/main/cc/require.lua").make(pgk_env, "rom/modules/main")
|
||||
local require = pgk_env.require
|
||||
|
||||
local expect = require("cc.expect")
|
||||
local expect, field = expect.expect, expect.field
|
||||
local wrap = dofile("rom/modules/main/cc/strings.lua").wrap
|
||||
local wrap = require("cc.strings").wrap
|
||||
|
||||
--- Slowly writes string text at current cursor position,
|
||||
-- character-by-character.
|
||||
|
@ -118,8 +118,8 @@ end
|
||||
--- Expect a number to be within a specific range.
|
||||
--
|
||||
-- @tparam number num The value to check.
|
||||
-- @tparam number min The minimum value, if nil then `-math.huge` is used.
|
||||
-- @tparam number max The maximum value, if nil then `math.huge` is used.
|
||||
-- @tparam[opt=-math.huge] number min The minimum value.
|
||||
-- @tparam[opt=math.huge] number max The maximum value.
|
||||
-- @return The given `value`.
|
||||
-- @throws If the value is outside of the allowed range.
|
||||
-- @since 1.96.0
|
||||
|
@ -8,7 +8,7 @@
|
||||
-- @since 1.95.0
|
||||
-- @see textutils For additional string related utilities.
|
||||
|
||||
local expect = (require and require("cc.expect") or dofile("rom/modules/main/cc/expect.lua")).expect
|
||||
local expect = require("cc.expect").expect
|
||||
|
||||
--[[- Wraps a block of text, so that each line fits within the given width.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user