All new forces will be added to the `global.forces` table. ---
This modules events should be registered after any other Init functions but before any scripts needing `global.players`. +--
All new forces will be added to the `storage.forces` table. +--
This modules events should be registered after any other Init functions but before any scripts needing `storage.players`. --
This modules can register the following events: `on_force_created`, and `on_forces_merging`. -- @module Event.Force -- @usage --- local Force = require('__stdlib__/stdlib/event/force').register_events() +-- local Force = require('__stdlib2__/stdlib/event/force').register_events() -- -- inside your Init event Force.init() -- to properly handle any existing forces -local Event = require('__stdlib__/stdlib/event/event') +local Event = require('__stdlib2__/stdlib/event/event') local Force = { __class = 'Force', - __index = require('__stdlib__/stdlib/core'), + __index = require('__stdlib2__/stdlib/core'), _new_force_data = {} } setmetatable(Force, Force) local inspect = _ENV.inspect -local Game = require('__stdlib__/stdlib/game') -local table = require('__stdlib__/stdlib/utils/table') -local merge_additional_data = require('__stdlib__/stdlib/event/modules/merge_data') +local Game = require('__stdlib2__/stdlib/game') +local table = require('__stdlib2__/stdlib/utils/table') +local merge_additional_data = require('__stdlib2__/stdlib/event/modules/merge_data') local assert, type = assert, type -- return new default force object @@ -44,29 +44,29 @@ function Force.additional_data(...) return Force end ---- Get `game.forces[name]` & `global.forces[name]`, or create `global.forces[name]` if it doesn't exist. +--- Get `game.forces[name]` & `storage.forces[name]`, or create `storage.forces[name]` if it doesn't exist. -- @tparam string|LuaForce force the force to get data for -- @treturn LuaForce the force instance -- @treturn table the force's global data -- @usage --- local Force = require('__stdlib__/stdlib/event/force') +-- local Force = require('__stdlib2__/stdlib/event/force') -- local force_name, force_data = Force.get("player") -- local force_name, force_data = Force.get(game.forces["player"]) -- -- Returns data for the force named "player" from either a string or LuaForce object function Force.get(force) force = Game.get_force(force) assert(force, 'force is missing') - return game.forces[force.name], global.forces and global.forces[force.name] or Force.init(force.name) + return game.forces[force.name], storage.forces and storage.forces[force.name] or Force.init(force.name) end ---- Merge a copy of the passed data to all forces in `global.forces`. +--- Merge a copy of the passed data to all forces in `storage.forces`. -- @tparam table data a table containing variables to merge -- @usage -- local data = {a = "abc", b = "def"} -- Force.add_data_all(data) function Force.add_data_all(data) table.each( - global.forces, + storage.forces, function(v) table.merge(v, table.deepcopy(data)) end @@ -78,19 +78,19 @@ end -- @tparam[opt] string|table event table or a string containing force name -- @tparam[opt=false] boolean overwrite the force data function Force.init(event, overwrite) - global.forces = global.forces or {} + storage.forces = storage.forces or {} local force = Game.get_force(event) if force then - if not global.forces[force.name] or (global.forces[force.name] and overwrite) then - global.forces[force.name] = new(force.name) - return global.forces[force.name] + if not storage.forces[force.name] or (storage.forces[force.name] and overwrite) then + storage.forces[force.name] = new(force.name) + return storage.forces[force.name] end else for name in pairs(game.forces) do - if not global.forces[name] or (global.forces[name] and overwrite) then - global.forces[name] = new(name) + if not storage.forces[name] or (storage.forces[name] and overwrite) then + storage.forces[name] = new(name) end end end @@ -99,12 +99,12 @@ end function Force.dump_data() game.write_file(Force.get_file_path('Force/force_data.lua'), 'return ' .. inspect(Force._new_force_data, { longkeys = true, arraykeys = true })) - game.write_file(Force.get_file_path('Force/global.lua'), 'return ' .. inspect(global.forces or nil, { longkeys = true, arraykeys = true })) + game.write_file(Force.get_file_path('Force/storage.lua'), 'return ' .. inspect(storage.forces or nil, { longkeys = true, arraykeys = true })) end --- When forces are merged, just remove the original forces data function Force.merged(event) - global.forces[event.source_name] = nil + storage.forces[event.source_name] = nil end function Force.register_init() diff --git a/stdlib/event/gui.lua b/stdlib/event/gui.lua index 8393b974..f212a20e 100644 --- a/stdlib/event/gui.lua +++ b/stdlib/event/gui.lua @@ -1,12 +1,12 @@ --- Makes monolithic Factorio GUI events more manageable. -- @module Event.Gui --- @usage local Gui = require('__stdlib__/stdlib/event/gui') +-- @usage local Gui = require('__stdlib2__/stdlib/event/gui') -local Event = require('__stdlib__/stdlib/event/event') +local Event = require('__stdlib2__/stdlib/event/event') local Gui = { __class = 'Gui', - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(Gui, Gui) diff --git a/stdlib/event/modules/merge_data.lua b/stdlib/event/modules/merge_data.lua index 1c91c01b..0be96d44 100644 --- a/stdlib/event/modules/merge_data.lua +++ b/stdlib/event/modules/merge_data.lua @@ -1,4 +1,4 @@ -local table = require('__stdlib__/stdlib/utils/table') +local table = require('__stdlib2__/stdlib/utils/table') local function merge_additional_data(additional_data_array, data) for _, new_data in pairs(additional_data_array) do diff --git a/stdlib/event/player.lua b/stdlib/event/player.lua index 93648f13..6c4fbf9c 100644 --- a/stdlib/event/player.lua +++ b/stdlib/event/player.lua @@ -2,20 +2,20 @@ -- This module adds player helper functions, it does not automatically register events unless Player.register_events() is called -- @module Event.Player -- @usage --- local Player = require('__stdlib__/stdlib/event/player').register_events() +-- local Player = require('__stdlib2__/stdlib/event/player').register_events() -- -- The fist time this is required it will register player creation events -local Event = require('__stdlib__/stdlib/event/event') +local Event = require('__stdlib2__/stdlib/event/event') local Player = { __class = 'Player', - __index = require('__stdlib__/stdlib/core'), + __index = require('__stdlib2__/stdlib/core'), _new_player_data = {} } setmetatable(Player, Player) -local Game = require('__stdlib__/stdlib/game') -local table = require('__stdlib__/stdlib/utils/table') -local merge_additional_data = require('__stdlib__/stdlib/event/modules/merge_data') +local Game = require('__stdlib2__/stdlib/game') +local table = require('__stdlib2__/stdlib/utils/table') +local merge_additional_data = require('__stdlib2__/stdlib/event/modules/merge_data') local assert, type = assert, type local inspect = _ENV.inspect @@ -40,31 +40,31 @@ function Player.additional_data(...) return Player end ---- Get `game.players[index]` & `global.players[index]`, or create `global.players[index]` if it doesn't exist. +--- Get `game.players[index]` & `storage.players[index]`, or create `storage.players[index]` if it doesn't exist. -- @tparam number|string|LuaPlayer player the player index to get data for -- @treturn LuaPlayer the player instance -- @treturn table the player's global data -- @usage --- local Player = require('__stdlib__/stdlib/event/player') +-- local Player = require('__stdlib2__/stdlib/event/player') -- local player, player_data = Player.get(event.player_index) function Player.get(player) player = Game.get_player(player) - return player, global.players and global.players[player.index] or Player.init(player.index) + return player, storage.players and storage.players[player.index] or Player.init(player.index) end --- Get the players saved data table. Creates it if it doesn't exsist. -- @tparam number index The player index to get data for -- @treturn table the player's global data function Player.pdata(index) - return global.players and global.players[index] or Player.init(index) + return storage.players and storage.players[index] or Player.init(index) end ---- Merge a copy of the passed data to all players in `global.players`. +--- Merge a copy of the passed data to all players in `storage.players`. -- @tparam table data a table containing variables to merge -- @usage local data = {a = 'abc', b = 'def'} -- Player.add_data_all(data) function Player.add_data_all(data) - local pdata = global.players + local pdata = storage.players table.each( pdata, function(v) @@ -76,7 +76,7 @@ end --- Remove data for a player when they are deleted. -- @tparam table event event table containing the `player_index` function Player.remove(event) - global.players[event.player_index] = nil + storage.players[event.player_index] = nil end --- Init or re-init a player or players. @@ -84,33 +84,33 @@ end -- @tparam[opt] number|table|string|LuaPlayer event -- @tparam[opt=false] boolean overwrite the player data function Player.init(event, overwrite) - -- Create the global.players table if it doesn't exisit - global.players = global.players or {} + -- Create the storage.players table if it doesn't exisit + storage.players = storage.players or {} --get a valid player object or nil local player = Game.get_player(event) if player then --If player is not nil then we are working with a valid player. - if not global.players[player.index] or (global.players[player.index] and overwrite) then - global.players[player.index] = new(player.index) - return global.players[player.index] + if not storage.players[player.index] or (storage.players[player.index] and overwrite) then + storage.players[player.index] = new(player.index) + return storage.players[player.index] end else --Check all players for index in pairs(game.players) do - if not global.players[index] or (global.players[index] and overwrite) then - global.players[index] = new(index) + if not storage.players[index] or (storage.players[index] and overwrite) then + storage.players[index] = new(index) end end end - if global._print_queue then + if storage._print_queue then table.each( - global._print_queue, + storage._print_queue, function(msg) game.print(tostring(msg)) end ) - global._print_queue = nil + storage._print_queue = nil end return Player end @@ -122,7 +122,7 @@ end function Player.dump_data() game.write_file(Player.get_file_path('Player/player_data.lua'), 'return ' .. inspect(Player._new_player_data, { longkeys = true, arraykeys = true })) - game.write_file(Player.get_file_path('Player/global.lua'), 'return ' .. inspect(global.players or nil, { longkeys = true, arraykeys = true })) + game.write_file(Player.get_file_path('Player/storage.lua'), 'return ' .. inspect(storage.players or nil, { longkeys = true, arraykeys = true })) end function Player.register_init() diff --git a/stdlib/event/surface.lua b/stdlib/event/surface.lua index 4e67a84d..0a942a18 100644 --- a/stdlib/event/surface.lua +++ b/stdlib/event/surface.lua @@ -1,21 +1,21 @@ --- Surface global creation. ---
All surfaces will be added to the `global.surfaces` table. ---
This modules events should be registered after any other Init functions but before any scripts needing `global.surfaces`. +--
All surfaces will be added to the `storage.surfaces` table. +--
This modules events should be registered after any other Init functions but before any scripts needing `storage.surfaces`. --
This modules can register the following events: -- @module Event.Surface -- @usage --- local surface = require('__stdlib__/stdlib/event/surface').register_events() +-- local surface = require('__stdlib2__/stdlib/event/surface').register_events() -local Event = require('__stdlib__/stdlib/event/event') +local Event = require('__stdlib2__/stdlib/event/event') local Surface = { __class = 'Surface', _new_surface_data = {} } -setmetatable(Surface, require('__stdlib__/stdlib/core')) +setmetatable(Surface, require('__stdlib2__/stdlib/core')) local inspect = _ENV.inspect -local merge_additional_data = require('__stdlib__/stdlib/event/modules/merge_data') +local merge_additional_data = require('__stdlib2__/stdlib/event/modules/merge_data') local function new(index) local surface = game.surfaces[index] @@ -40,11 +40,11 @@ end --- Remove data for a surface when it is deleted. -- @tparam table event event table containing the surface index function Surface.remove(event) - global.surfaces[event.surface_index] = nil + storage.surfaces[event.surface_index] = nil end function Surface.rename(event) - global.surfaces[event.surface_index].name = event.new_name + storage.surfaces[event.surface_index].name = event.new_name end function Surface.import(event) @@ -59,21 +59,21 @@ end -- @tparam[opt] number|table|string|LuaSurface event -- @tparam[opt=false] boolean overwrite the surface data function Surface.init(event, overwrite) - -- Create the global.surfaces table if it doesn't exisit - global.surfaces = global.surfaces or {} + -- Create the storage.surfaces table if it doesn't exisit + storage.surfaces = storage.surfaces or {} --get a valid surface object or nil local surface = game.surfaces[event.surface_index] if surface then - if not global.surfaces[surface.index] or (global.surfaces[surface.index] and overwrite) then - global.surfaces[surface.index] = new(surface.index) - return global.surfaces[surface.index] + if not storage.surfaces[surface.index] or (storage.surfaces[surface.index] and overwrite) then + storage.surfaces[surface.index] = new(surface.index) + return storage.surfaces[surface.index] end else --Check all surfaces for index in pairs(game.surfaces) do - if not global.surfaces[index] or (global.surfaces[index] and overwrite) then - global.surfaces[index] = new(index) + if not storage.surfaces[index] or (storage.surfaces[index] and overwrite) then + storage.surfaces[index] = new(index) end end end @@ -82,7 +82,7 @@ end function Surface.dump_data() game.write_file(Surface.get_file_path('Surface/surface_data.lua'), inspect(Surface._new_surface_data, { longkeys = true, arraykeys = true })) - game.write_file(Surface.get_file_path('Surface/global.lua'), inspect(global.surfaces or nil, { longkeys = true, arraykeys = true })) + game.write_file(Surface.get_file_path('Surface/global.lua'), inspect(storage.surfaces or nil, { longkeys = true, arraykeys = true })) end function Surface.register_init() diff --git a/stdlib/event/trains.lua b/stdlib/event/trains.lua index 3623eaf4..af941878 100644 --- a/stdlib/event/trains.lua +++ b/stdlib/event/trains.lua @@ -6,14 +6,14 @@ local Trains = { __class = 'Trains', - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(Trains, Trains) -local Event = require('__stdlib__/stdlib/event/event') -local Surface = require('__stdlib__/stdlib/area/surface') -local Entity = require('__stdlib__/stdlib/entity/entity') -local table = require('__stdlib__/stdlib/utils/table') +local Event = require('__stdlib2__/stdlib/event/event') +local Surface = require('__stdlib2__/stdlib/area/surface') +local Entity = require('__stdlib2__/stdlib/entity/entity') +local table = require('__stdlib2__/stdlib/utils/table') --- This event fires when a train's ID changes. --
The train ID is a property of the main locomotive, @@ -101,7 +101,7 @@ end function Trains._on_locomotive_changed() -- For all the known trains local renames = {} - for id, train in pairs(global._train_registry) do + for id, train in pairs(storage._train_registry) do -- Check if their known ID is the same as the LuaTrain's dervied id local derived_id = Trains.get_train_id(train) -- If it's not @@ -115,8 +115,8 @@ function Trains._on_locomotive_changed() for _, renaming in pairs(renames) do -- Rename it in the registry -- and dispatch a renamed event - global._train_registry[renaming.new_id] = renaming.train - global._train_registry[renaming.old_id] = nil + storage._train_registry[renaming.new_id] = renaming.train + storage._train_registry[renaming.old_id] = nil local event_data = { old_id = renaming.old_id, @@ -181,19 +181,19 @@ end -- Creates a registry of known trains. -- @return table a mapping of train id to LuaTrain object function Trains.create_train_registry() - global._train_registry = global._train_registry or {} + storage._train_registry = storage._train_registry or {} local all_trains = Trains.find_filtered() for _, trainInfo in pairs(all_trains) do - global._train_registry[tonumber(trainInfo.id)] = trainInfo.train + storage._train_registry[tonumber(trainInfo.id)] = trainInfo.train end - return global._train_registry + return storage._train_registry end function Trains.on_train_created(event) local train_id = Trains.get_train_id(event.train) - global._train_registry[train_id] = event.train + storage._train_registry[train_id] = event.train end --- This needs to be called to register events for this module diff --git a/stdlib/game.lua b/stdlib/game.lua index 49014bce..56cd0dc6 100644 --- a/stdlib/game.lua +++ b/stdlib/game.lua @@ -1,10 +1,10 @@ --- The game module. -- @module Game --- @usage local Game = require('__stdlib__/stdlib/game') +-- @usage local Game = require('__stdlib2__/stdlib/game') local Game = { __class = 'Game', - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(Game, Game) local inspect = _ENV.inspect @@ -55,7 +55,7 @@ end --- Messages all players currently connected to the game. --> Offline players are not counted as having received the message. --- If no players exist msg is stored in the `global._print_queue` table. +-- If no players exist msg is stored in the `storage._print_queue` table. -- @tparam string msg the message to send to players -- @tparam[opt] ?|nil|boolean condition the condition to be true for a player to be messaged -- @treturn uint the number of players who received the message. @@ -70,8 +70,8 @@ function Game.print_all(msg, condition) end return num else - global._print_queue = global._print_queue or {} - global._print_queue[#global._print_queue + 1] = msg + storage._print_queue = storage._print_queue or {} + storage._print_queue[#storage._print_queue + 1] = msg end end @@ -84,13 +84,13 @@ end -- @treturn mixed the chunk value stored at the key or the previous value function Game.get_or_set_data(sub_table, index, key, set, value) assert(type(sub_table) == 'string', 'sub_table must be a string') - global[sub_table] = global[sub_table] or {} + storage[sub_table] = storage[sub_table] or {} local this if index then - global[sub_table][index] = global[sub_table][index] or {} - this = global[sub_table][index] + storage[sub_table][index] = storage[sub_table][index] or {} + this = storage[sub_table][index] else - this = global[sub_table] + this = storage[sub_table] end local previous diff --git a/stdlib/misc/config.lua b/stdlib/misc/config.lua index da0d384b..2305bdab 100644 --- a/stdlib/misc/config.lua +++ b/stdlib/misc/config.lua @@ -1,6 +1,6 @@ --- For working with mod configurations. -- @module Misc.Config --- @usage require('__stdlib__/stdlib/config/config') +-- @usage require('__stdlib2__/stdlib/config/config') --- -- @tfield function new @@ -11,11 +11,11 @@ -- @table Config local M = { __class = 'Config', - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(M, M) -local table = require('__stdlib__/stdlib/utils/table') -local string = require('__stdlib__/stdlib/utils/string') +local table = require('__stdlib2__/stdlib/utils/table') +local string = require('__stdlib2__/stdlib/utils/string') ----------------------------------------------------------------------- --Setup repeated code for use in sub functions here @@ -35,30 +35,30 @@ end -- @tparam table config_table the config table to manage -- @treturn Config the Config object to manage the config table -- --- @usage --[Use a global table for config that persists across game save/loads] --- CONFIG = Config.new(global.testtable) +-- @usage --[Use a storage table for config that persists across game save/loads] +-- CONFIG = Config.new(storage.testtable) -- -- @usage --[You can also create a temporary scratch pad config] -- CONFIG = Config.new({}) -- Temporary scratch pad -- -- @usage --[Setting data in Config] --- CONFIG = Config.new(global.testtable) +-- CONFIG = Config.new(storage.testtable) -- CONFIG.set("your.path.here", "myvalue") -- -- @usage --[Getting data out of Config] --- CONFIG = Config.new(global.testtable) +-- CONFIG = Config.new(storage.testtable) -- my_data = CONFIG.get("your.path.here") -- -- @usage --[Getting data out of Config with a default to use if path is not found in Config] --- CONFIG = Config.new(global.testtable) +-- CONFIG = Config.new(storage.testtable) -- my_data = CONFIG.get("your.path.here", "Your Default here") -- -- @usage --[Deleting a path from Config] --- CONFIG = Config.new(global.testtable) +-- CONFIG = Config.new(storage.testtable) -- CONFIG.delete("your.path.here") -- -- @usage --[Checking if a path exists in Config] --- CONFIG = Config.new(global.testtable) +-- CONFIG = Config.new(storage.testtable) -- CONFIG.is_set("your.path.here") function M.new(config_table) if not config_table then diff --git a/stdlib/misc/logger.lua b/stdlib/misc/logger.lua index cb07c047..f654419f 100644 --- a/stdlib/misc/logger.lua +++ b/stdlib/misc/logger.lua @@ -1,9 +1,9 @@ --- For logging debug information to files. -- @module Misc.Logger -- @usage --- local Logger = require('__stdlib__/stdlib/misc/logger') +-- local Logger = require('__stdlib2__/stdlib/misc/logger') -- -- or to create a new logger directly: --- local Log = require('__stdlib__/stdlib/misc/logger').new() +-- local Log = require('__stdlib2__/stdlib/misc/logger').new() -- -- log files are saved to script-output/modname/log.log by default local Logger = { @@ -12,11 +12,11 @@ local Logger = { __call = function(self, ...) return self.get(...) end, - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(Logger, Logger) -local table = require('__stdlib__/stdlib/utils/table') +local table = require('__stdlib2__/stdlib/utils/table') -- Set on the individual log object, either logs a message or writes immediatly if nil. local _Log_mt = { @@ -138,7 +138,7 @@ function Logger.new(log_name, debug_mode, options) function Log.write() if _G.game and table.size(Log.buffer) > 0 then Log.last_written = game.tick - game.write_file(Log.file_name, table.concat(Log.buffer), Log.ever_written) + helpers.write_file(Log.file_name, table.concat(Log.buffer), Log.ever_written) Log.buffer = {} Log.ever_written = true end diff --git a/stdlib/misc/migrate.lua b/stdlib/misc/migrate.lua index 4e33e041..c0ed4467 100644 --- a/stdlib/misc/migrate.lua +++ b/stdlib/misc/migrate.lua @@ -3,11 +3,11 @@ local Migrate = { __class = 'Migrate', - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(Migrate, Migrate) -local Is = require('__stdlib__/stdlib/utils/is') +local Is = require('__stdlib2__/stdlib/utils/is') --- Migrate a dictionary of recipe -> tech names -- @tparam dictionary dictionary diff --git a/stdlib/misc/queue.lua b/stdlib/misc/queue.lua index fe3f1da3..497eeed0 100644 --- a/stdlib/misc/queue.lua +++ b/stdlib/misc/queue.lua @@ -2,7 +2,7 @@ -- Taken from ***Programming in Lua*** [Queues and Double Queues](http://www.lua.org/pil/11.4.html) -- and modified to not allow nil values, and returns nil if @{pop_first} or @{pop_last} is used when the queue is empty. -- @module Misc.Queue --- @usage local Queue = require('__stdlib__/stdlib/misc/queue') +-- @usage local Queue = require('__stdlib2__/stdlib/misc/queue') -- local q = Queue() -- create a new empty queue -- q('my value') -- push a value onto the queue -- q() -- pop the last value off the queue @@ -10,14 +10,14 @@ local Queue = { __class = 'Queue', - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(Queue, Queue) -local table = require('__stdlib__/stdlib/utils/table') +local table = require('__stdlib2__/stdlib/utils/table') local t_size = table_size -local Inspect = require('__stdlib__/stdlib/vendor/inspect') +local Inspect = require('__stdlib2__/stdlib/vendor/inspect') local meta = {} @@ -37,11 +37,11 @@ function Queue.new(...) return Queue.__call(nil, ...) end ---- Load global.queue or queues during on_load, as metatables are not persisted. ---
This is only needed if you are using the queue as an object and storing it in global. +--- Load storage.queue or queues during on_load, as metatables are not persisted. +--
This is only needed if you are using the queue as an object and storing it in storage. -- @tparam table queue (@{Queue},...) --- @usage global.myqueue1 = Queue.new() --- script.on_load(function() Queue.load(global.myqueue)) +-- @usage storage.myqueue1 = Queue.new() +-- script.on_load(function() Queue.load(storage.myqueue)) function Queue.load(queue) if type(queue) == 'table' and queue.first then return setmetatable(queue, meta) diff --git a/stdlib/scripts/interface.lua b/stdlib/scripts/interface.lua index e5c303fd..4b7bb994 100644 --- a/stdlib/scripts/interface.lua +++ b/stdlib/scripts/interface.lua @@ -1,19 +1,19 @@ --[[ A basic interface script, with generic functions usage: - local interface = require(__stdlib__/stdlib/scripts/interface) + local interface = require(__stdlib2__/stdlib/scripts/interface) interface.myfunc = function() end remote.add_interface(script.mod_name, interface) interface.myfunc2 = function() end -- Can even add new functions afterwards! ]] -- local interface = {} -local Table = require('__stdlib__/stdlib/utils/table') +local Table = require('__stdlib2__/stdlib/utils/table') -local Event = require('__stdlib__/stdlib/event/event') -local Game = require('__stdlib__/stdlib/game') -local Changes = require('__stdlib__/stdlib/event/changes') -local Player = require('__stdlib__/stdlib/event/player') -local Force = require('__stdlib__/stdlib/event/force') +local Event = require('__stdlib2__/stdlib/event/event') +local Game = require('__stdlib2__/stdlib/game') +local Changes = require('__stdlib2__/stdlib/event/changes') +local Player = require('__stdlib2__/stdlib/event/player') +local Force = require('__stdlib2__/stdlib/event/force') local ignore_defines = Table.invert { 'anticolor', 'lightcolor', 'color', 'time' } diff --git a/stdlib/scripts/quickstart.lua b/stdlib/scripts/quickstart.lua index eb762bf8..81e6f9d2 100644 --- a/stdlib/scripts/quickstart.lua +++ b/stdlib/scripts/quickstart.lua @@ -5,18 +5,18 @@ -- @usage -- -- For use with STDLIB Events -- if DEBUG then --- require('__stdlib__/stdlib/scripts/quickstart').register_events() +-- require('__stdlib2__/stdlib/scripts/quickstart').register_events() -- end -- @usage -- --If not using stdlibs event system --- local quickstart = require('__stdlib__/stdlib/scripts/quickstart') +-- local quickstart = require('__stdlib2__/stdlib/scripts/quickstart') -- script.on_event(defines.events.on_player_created, function() -- quickstart.on_player_created() -- can be wrapped in an if DEBUG type check -- end) -local Event = require('__stdlib__/stdlib/event/event') -local Area = require('__stdlib__/stdlib/area/area') -local QS = require('__stdlib__/stdlib/misc/config').new(_ENV.prequire('config-quickstart') or {}) +local Event = require('__stdlib2__/stdlib/event/event') +local Area = require('__stdlib2__/stdlib/area/area') +local QS = require('__stdlib2__/stdlib/misc/config').new(_ENV.prequire('config-quickstart') or {}) if not remote.interfaces['quickstart_script'] then local qs_interface = {} @@ -81,13 +81,13 @@ function quickstart.on_player_created(event) end local power_armor = QS.get('power_armor', 'fake') - if player.character and game.item_prototypes[power_armor] then + if player.character and prototypes.item[power_armor] then --Put on power armor, install equipment player.get_inventory(defines.inventory.character_armor).insert(power_armor) local grid = player.character.grid if grid then for _, eq in pairs(QS.get('equipment', { 'fusion-reactor-equipment' })) do - if game.equipment_prototypes[eq] then + if prototypes.equipment[eq] then grid.put { name = eq } end end @@ -219,11 +219,11 @@ function quickstart.on_player_created(event) end if QS.get('setup_power', false) then - if game.entity_prototypes['debug-energy-interface'] then + if prototypes.entity['debug-energy-interface'] then local es = surface.create_entity { name = 'debug-energy-interface', position = { 0, 0 }, force = force, raise_built = true } es.destructible = false end - if game.entity_prototypes['debug-substation'] then + if prototypes.entity['debug-substation'] then local sb = surface.create_entity { name = 'debug-substation', position = { 0, 0 }, force = force, raise_built = true } sb.destructible = false end diff --git a/stdlib/utils/classes/linked_list.lua b/stdlib/utils/classes/linked_list.lua index a2ac7ef4..bec36e3f 100644 --- a/stdlib/utils/classes/linked_list.lua +++ b/stdlib/utils/classes/linked_list.lua @@ -1,9 +1,9 @@ --- A double-linked list implementation -- @classmod LinkedList -local Core = require('__stdlib__/stdlib/core') -local table = require('__stdlib__/stdlib/utils/table') -local Is = require('__stdlib__/stdlib/utils/is') +local Core = require('__stdlib2__/stdlib/core') +local table = require('__stdlib2__/stdlib/utils/table') +local Is = require('__stdlib2__/stdlib/utils/is') -- dumb shallow copy suitable for cloning instance metatables in subclasses local _mtcopy = function(self) diff --git a/stdlib/utils/classes/unique_array.lua b/stdlib/utils/classes/unique_array.lua index b67928a4..010f0bc4 100644 --- a/stdlib/utils/classes/unique_array.lua +++ b/stdlib/utils/classes/unique_array.lua @@ -3,7 +3,7 @@ -- @classmod unique_array -- Adding or removeing values without using the provided methods can break the functionality of this class. -- Additional methods exported by requering unique_array are .set and .make_dictionary --- @usage local Unique_Array = require('__stdlib__/stdlib/utils/classes/unique_array') +-- @usage local Unique_Array = require('__stdlib2__/stdlib/utils/classes/unique_array') -- local my_array = Unique_Array('first') -- my_array:add('second') -- if my_array['second'] then diff --git a/stdlib/utils/color.lua b/stdlib/utils/color.lua index 5df051f2..ccc87a83 100644 --- a/stdlib/utils/color.lua +++ b/stdlib/utils/color.lua @@ -1,24 +1,24 @@ --- For playing with colors. -- @module Utils.Color --- @usage local Color = require('__stdlib__/stdlib/utils/color') +-- @usage local Color = require('__stdlib2__/stdlib/utils/color') local Color = { __class = 'Color', - __index = require('__stdlib__/stdlib/core') + __index = require('__stdlib2__/stdlib/core') } setmetatable(Color, Color) local metatable -local table = require('__stdlib__/stdlib/utils/table') -local math = require('__stdlib__/stdlib/utils/math') -local color_list = require('__stdlib__/stdlib/utils/defines/color_list') +local table = require('__stdlib2__/stdlib/utils/table') +local math = require('__stdlib2__/stdlib/utils/math') +local color_list = require('__stdlib2__/stdlib/utils/defines/color_list') ---- @table color @{defines.color} -Color.color = require('__stdlib__/stdlib/utils/defines/color') ---- @table anticolor @{defines.anticolor} -Color.anticolor = require('__stdlib__/stdlib/utils/defines/anticolor') ---- @table lightcolor @{defines.lightcolor} -Color.lightcolor = require('__stdlib__/stdlib/utils/defines/lightcolor') +---@table color @{defines.color} +Color.color = require('__stdlib2__/stdlib/utils/defines/color') +---@table anticolor @{defines.anticolor} +Color.anticolor = require('__stdlib2__/stdlib/utils/defines/anticolor') +---@table lightcolor @{defines.lightcolor} +Color.lightcolor = require('__stdlib2__/stdlib/utils/defines/lightcolor') --- Color Constructors -- @section Color Constructors @@ -116,7 +116,7 @@ function Color.from_params(r, g, b, a) local new = Color.normalize { r = r, g = g or r, b = b or r, a = a or 0.5 } return setmetatable(new, metatable) end ---- @see Color.from_params +---@see Color.from_params Color.from_rgb = Color.from_params --- Converts a color in the array format to a color in the table format. @@ -159,7 +159,7 @@ function Color.from_hex(color, alpha) return setmetatable(new, metatable) end ---- @section end +---@section end --- Color Methods -- @section Color Methods @@ -284,7 +284,7 @@ function Color.unary(color) return Color.len(color) < 1.5 and Color.white() or Color.black() end ---- @section end +---@section end --- Color Functions -- @section Color Functions @@ -342,7 +342,7 @@ function Color.to_array(color) return { color.r, color.g, color.b, color.a } end ---- @see Color.to_array +---@see Color.to_array Color.pack = Color.to_array --- Return the color as 4 paramaters. @@ -355,7 +355,7 @@ function Color.to_params(color) return color.r, color.g, color.b, color.a end ---- @see Color.to_params +---@see Color.to_params Color.unpack = Color.to_params --- Return the Color as a string. @@ -418,7 +418,7 @@ function Color.best_color_match(color) return closest end ---- @section end +---@section end metatable = { __class = 'color', diff --git a/stdlib/utils/defines/anticolor.lua b/stdlib/utils/defines/anticolor.lua index dcee7569..c2ae5760 100644 --- a/stdlib/utils/defines/anticolor.lua +++ b/stdlib/utils/defines/anticolor.lua @@ -1,6 +1,6 @@ --- A defines module for retrieving colors by name. -- Extends the Factorio defines table. --- @usage require('__stdlib__/stdlib/utils/defines/anticolor') +-- @usage require('__stdlib2__/stdlib/utils/defines/anticolor') -- @module defines.anticolor -- @see Concepts.Color @@ -26,7 +26,7 @@ -- @tfield Concepts.Color purple defines.color.white -- @tfield Concepts.Color red defines.color.white local anticolor = {} -local colors = require('__stdlib__/stdlib/utils/defines/color_list') +local colors = require('__stdlib2__/stdlib/utils/defines/color_list') local anticolors = { green = colors.black, diff --git a/stdlib/utils/defines/color.lua b/stdlib/utils/defines/color.lua index c183db53..61f30d40 100644 --- a/stdlib/utils/defines/color.lua +++ b/stdlib/utils/defines/color.lua @@ -1,6 +1,6 @@ --- A defines module for retrieving colors by name. -- Extends the Factorio defines table. --- @usage require('__stdlib__/stdlib/utils/defines/color') +-- @usage require('__stdlib2__/stdlib/utils/defines/color') -- @module defines.color -- @see Concepts.Color @@ -29,7 +29,7 @@ -- @tfield Concepts.Color purple -- @tfield Concepts.Color brown local color = {} -local colors = require('__stdlib__/stdlib/utils/defines/color_list') +local colors = require('__stdlib2__/stdlib/utils/defines/color_list') local _mt = { __index = function(_, c) diff --git a/stdlib/utils/defines/lightcolor.lua b/stdlib/utils/defines/lightcolor.lua index ae8d86a3..134e93c4 100644 --- a/stdlib/utils/defines/lightcolor.lua +++ b/stdlib/utils/defines/lightcolor.lua @@ -1,6 +1,6 @@ --- A defines module for retrieving colors by name. -- Extends the Factorio defines table. --- @usage require('__stdlib__/stdlib/utils/defines/lightcolor') +-- @usage require('__stdlib2__/stdlib/utils/defines/lightcolor') -- @module defines.lightcolor -- @see Concepts.Color @@ -17,7 +17,7 @@ -- @tfield Concepts.Color yellow defines.color.orange -- @tfield Concepts.Color pink defines.color.purple local lightcolor = {} -local colors = require('__stdlib__/stdlib/utils/defines/color_list') +local colors = require('__stdlib2__/stdlib/utils/defines/color_list') local lightcolors = { white = colors.lightgrey, diff --git a/stdlib/utils/globals.lua b/stdlib/utils/globals.lua index 70010e2d..fe31709b 100644 --- a/stdlib/utils/globals.lua +++ b/stdlib/utils/globals.lua @@ -3,11 +3,11 @@ _ENV = _ENV or _G -local config = require('__stdlib__/stdlib/config') +local config = require('__stdlib2__/stdlib/config') -local Table = require('__stdlib__/stdlib/utils/table') -local Math = require('__stdlib__/stdlib/utils/math') -local String = require('__stdlib__/stdlib/utils/string') +local Table = require('__stdlib2__/stdlib/utils/table') +local Math = require('__stdlib2__/stdlib/utils/math') +local String = require('__stdlib2__/stdlib/utils/string') local STDLIB = { Math = Math, @@ -53,14 +53,14 @@ end or function() end rawset(_ENV, 'data_traceback', data_traceback) -local inspect = require('__stdlib__/stdlib/vendor/inspect') +local inspect = require('__stdlib2__/stdlib/vendor/inspect') rawset(_ENV, 'inspect', inspect) -- Defines Mutates -require('__stdlib__/stdlib/utils/defines/color') -require('__stdlib__/stdlib/utils/defines/anticolor') -require('__stdlib__/stdlib/utils/defines/lightcolor') -require('__stdlib__/stdlib/utils/defines/time') +require('__stdlib2__/stdlib/utils/defines/color') +require('__stdlib2__/stdlib/utils/defines/anticolor') +require('__stdlib2__/stdlib/utils/defines/lightcolor') +require('__stdlib2__/stdlib/utils/defines/time') --- Require a file that may not exist -- @tparam string module path to the module @@ -176,7 +176,7 @@ function STDLIB.create_stdlib_globals(files) MATH = 'stdlib/utils/math' } for glob, path in pairs(files) do - rawset(_ENV, glob, require('__stdlib__/' .. (path:gsub('%.', '/')))) -- extra () required to emulate select(1) + rawset(_ENV, glob, require('__stdlib2__/' .. (path:gsub('%.', '/')))) -- extra () required to emulate select(1) end end diff --git a/stdlib/utils/is.lua b/stdlib/utils/is.lua index 08c225fa..8a8a80cd 100644 --- a/stdlib/utils/is.lua +++ b/stdlib/utils/is.lua @@ -1,50 +1,29 @@ --- Is expression library --- @module Utils.Is --- @usage --- local Is = require('__stdlib__/stdlib/utils/is') +-- local Is = require('__stdlib2__/stdlib/utils/is') -- Is.True(true) -- Is.Not.True(false) -- Is.Assert.True(true) -- Is.Assert.Not.True(false) --- Is Table --- @section Table --- Is the test true. --- @table Is --- @field Not Is the test not true. --- @field Assert Assert that the test is true. --- @field Assert.Not Assert that the test is not true. --- Is Table Callers --- @section Callers --- Is the test truthy --- @function Is --- @tparam mixed var --- @treturn boolean local Is = {} --- Is the test not truthy --- @function Not --- @tparam mixed var --- @treturn boolean Is.Not = {} --- Assert that the test is Truthy --- @function Assert --- @tparam mixed var --- @treturn boolean Is.Assert = {} --- Assert that the test is not Truthy --- @function Assert.Not --- @tparam mixed var --- @treturn boolean Is.Assert.Not = {} --- Functions --- @section Functions local M = {} @@ -53,90 +32,94 @@ local floor = math.floor local huge = math.huge --- Returns the var if the passed variable is a table. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return table? function M.Table(var) return type(var) == 'table' and var end M.table = M.Table --- Returns the var if the passed variable is a string. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return string? function M.String(var) return type(var) == 'string' and var end M.string = M.String --- Returns the var if the passed variable is a number. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return number? function M.Number(var) return type(var) == 'number' and var end M.number = M.Number +---@param var any? The variable to check +---@return thread? function M.Thread(var) return type(var) == 'thread' and var end M.thread = M.Thread +---@param var any? The variable to check +---@return userdata? function M.Userdata(var) return type(var) == 'userdata' and var end M.userdata = M.Userdata --- Returns true if the passed variable is nil. --- @tparam mixed var The variable to check --- @treturn boolean +---@param var any? The variable to check +---@return boolean function M.Nil(var) return type(var) == 'nil' end M.is_nil = M.Nil --- Returns true if the passed variable is a boolean. --- @tparam mixed var The variable to check --- @treturn boolean +---@param var any? The variable to check +---@return boolean function M.Boolean(var) return type(var) == 'boolean' end M.boolean = M.boolean --- Returns true if the passed variable is true --- @tparam mixed var The variable to check --- @treturn boolean +---@param var any? The variable to check +---@return boolean function M.True(var) return var == true end M.is_true = M.True --- Returns the var if the passed variable is not nil or false. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return any function M.Truthy(var) return var or false end M.truthy = M.Truthy --- Returns true if the passed variable is false. --- @tparam mixed var The variable to check --- @treturn boolean +---@param var any? The variable to check +---@return boolean function M.False(var) return var == false end M.is_false = M.False --- Returns true if the passed variable is false or nil. --- @tparam mixed var The variable to check --- @treturn boolean +---@param var any? The variable to check +---@return boolean function M.Falsy(var) return not var end M.falsy = M.Falsy --- Returns true if the passed variable is nil, an empty table, or an empty string. --- @tparam mixed var The variable to check --- @treturn boolean +---@param var any? The variable to check +---@return boolean function M.Empty(var) if M.Table(var) then return table_size and table_size(var) == 0 or next(var) == nil @@ -147,164 +130,166 @@ function M.Empty(var) end M.empty = M.Empty +---@param var any? The variable to check +---@return boolean function M.None(var) return M.Empty(var) or M.False(var) or var == 0 or var ~= var end M.none = M.None --- Returns the passed var if it is positive. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return number? function M.Positive(var) return M.Number(var) and var >= 0 and var end M.positive = M.Positive --- Returns the passed var if it is odd. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return number? function M.odd(var) return M.number(var) and (var % 2 ~= 0) and var end --- Returns the passed var if it is even. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return number? function M.even(var) return M.number(var) and (var % 2 == 0) and var end --- Returns the passed var if it is negative. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return number? function M.Negative(var) return M.Number(var) and var < 0 and var end M.negative = M.Negative --- Returns the passed var if it is not a number. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return boolean function M.NaN(var) return var ~= var end M.nan = M.NaN --- Returns the passed var if it is finite. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return number? function M.Finite(var) return M.Number(var) and (var < huge and var > -huge) and var end M.finite = M.Finite --- Returns the passed var if it is an int. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return integer? function M.Int(var) return M.Finite(var) and rawequal(floor(var), var) and var end M.int = M.Int --- Returns the passed var if it is an int8. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return int8? function M.Int8(var) return M.Int(var) and var >= -128 and var <= 127 and var end M.int8 = M.Int8 --- Returns the passed var if it is an int16. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return int16? function M.Int16(var) return M.Int(var) and var >= -32768 and var <= 32767 and var end M.int16 = M.Int16 --- Returns the passed var if it is an int32. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return int32? function M.Int32(var) return M.Int(var) and var >= -2147483648 and var <= 2147483647 and var end M.int32 = M.Int32 --- Returns the passed var if it is an unsigned int. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return uint? function M.Unsigned(var) return Is.Number(var) and (var < huge and var >= 0) and var end M.unsigned = M.Unsigned --- Returns the passed var if it is an unsigned int. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return uint? function M.UInt(var) return M.Unsigned(var) and rawequal(floor(var), var) and var end M.uint = M.UInt --- Returns the passed var if it is an unsigned int8. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return uint8? function M.UInt8(var) return M.UInt(var) and var <= 255 and var end M.uint8 = M.UInt8 --- Returns the passed var if it is an unsigned int16. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return uint16? function M.UInt16(var) return M.UInt(var) and var <= 65535 and var end M.uint16 = M.UInt16 --- Returns the passed var if it is an unsigned int32. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return uint32? function M.UInt32(var) return M.UInt(var) and var <= 4294967295 and var end M.uint32 = M.UInt32 --- Returns the passed var if it is a float. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return float? function M.Float(var) return M.number(var) and var >= 0 and var < 1 and var end M.float = M.Float --- Returns the passed var if it is a full position. --- @tparam mixed var The variable to check --- @treturn mixed +---@param var any? The variable to check +---@return Area.Position? function M.Position(var) return M.Table(var) and (var.x and var.y) and var end M.position = M.Position --- Returns the passed var if it is a full area. --- @tparam mixed var The variable to check --- @treturn mixed +---@tparam mixed var The variable to check +---@treturn mixed function M.Area(var) return M.Table(var) and (M.Position(var.left_top) and M.Position(var.right_bottom)) and var end M.area = M.Area --- Returns the passed var if it is a simple position/vector. --- @tparam mixed var The variable to check --- @treturn mixed +---@tparam mixed var The variable to check +---@treturn mixed function M.Vector(var) return M.Table(var) and ((M.Number(var[1]) and M.Number(var[2])) or M.Position(var)) and var end M.vector = M.Vector --- Returns the passed var if it is a simple area/boundingbox. --- @tparam mixed var The variable to check --- @treturn mixed +---@tparam mixed var The variable to check +---@treturn mixed function M.BoundingBox(var) return M.Table(var) and (M.Vector(var[1]) and M.Vector(var[2])) end @@ -313,8 +298,8 @@ M.bounding_box = M.BoundingBox M.Bounding_Box = M.BoundingBox --- Returns the hex value of the passed var if it is hexadecimal. --- @tparam mixed var The variable to check --- @treturn mixed +---@tparam mixed var The variable to check +---@treturn mixed function M.Hex(var) return M.String(var) and var:match('%x%x%x%x%x%x$') end @@ -322,8 +307,8 @@ M.hex = M.Hex --- Returns true if the passed variable is a single alphbetical word. -- Does not allow any special chars --- @tparam mixed var The variable to check --- @treturn boolean true if the passed variable is a single alphbetical word +---@tparam mixed var The variable to check +---@treturn boolean true if the passed variable is a single alphbetical word function M.StrictWord(var) return M.String(var) and var:find('^[%a]+$') == 1 end @@ -331,8 +316,8 @@ M.strict_word = M.StrictWord --- Returns true if the passed variable is a single alphbetical word. -- Allows _ and - as part of the word --- @tparam mixed var The variable to check --- @treturn boolean true if the passed variable is a single alphbetical word +---@tparam mixed var The variable to check +---@treturn boolean true if the passed variable is a single alphbetical word function M.AlphabetWord(var) return M.String(var) and var:find('^[%a%_%-]+$') == 1 end @@ -340,8 +325,8 @@ M.Word = M.AlphabetWord --- Returns true if the passed variable is a single alphbetical word. -- Must start with a letter, allows _ and - as part of the word --- @tparam mixed var The variable to check --- @treturn boolean true if the passed variable is a single alphbetical word +---@tparam mixed var The variable to check +---@treturn boolean true if the passed variable is a single alphbetical word function M.AlphanumWord(var) return M.String(var) and var:find('^%a+[%w%_%-]*$') == 1 end @@ -350,24 +335,24 @@ M.alpha = M.AlphanumWord M.alphanumword = M.AlphanumWord --- Is this a factorio object --- @tparam LuaObject var The variable to check --- @treturn mixed the var if this is an LuaObject +---@tparam LuaObject var The variable to check +---@treturn mixed the var if this is an LuaObject function M.Object(var) - return M.Table(var) and var.__self and var + return M.Userdata(var) and var end M.object = M.Object --- Is this factorio object valid --- @tparam LuaObject var The variable to check --- @treturn mixed the var if this is a valid LuaObject +---@tparam LuaObject var The variable to check +---@treturn mixed the var if this is a valid LuaObject function M.Valid(var) return M.Object(var) and var.valid and var end M.valid = M.Valid --- Returns true if the passed variable is a callable function. --- @tparam mixed var The variable to check --- @treturn boolean true if the passed variable is a callable function +---@tparam mixed var The variable to check +---@treturn boolean true if the passed variable is a callable function function M.Callable(var) return type(var) == 'function' or type((getmetatable(var) or {}).__call) == 'function' end diff --git a/stdlib/utils/math.lua b/stdlib/utils/math.lua index 3088fa98..d3ee83ca 100644 --- a/stdlib/utils/math.lua +++ b/stdlib/utils/math.lua @@ -1,7 +1,7 @@ --- Extends Lua 5.2 math. -- @module Utils.math -- @see math --- @usage local math = require('__stdlib__/stdlib/utils/math') +-- @usage local math = require('__stdlib2__/stdlib/utils/math') local Math = {} Math.frexp = math.frexp diff --git a/stdlib/utils/string.lua b/stdlib/utils/string.lua index 2473947e..162acbc6 100644 --- a/stdlib/utils/string.lua +++ b/stdlib/utils/string.lua @@ -1,7 +1,7 @@ --- Extends Lua 5.2 string. -- @module Utils.string -- @see string --- @usage local string = require('__stdlib__/stdlib/utils/string') +-- @usage local string = require('__stdlib2__/stdlib/utils/string') local String = {} String.find = string.find diff --git a/stdlib/utils/table.lua b/stdlib/utils/table.lua index 7c1df387..c23121cf 100644 --- a/stdlib/utils/table.lua +++ b/stdlib/utils/table.lua @@ -1,7 +1,7 @@ --- Extends Lua 5.2 table. -- @module Utils.table -- @see table --- @usage local table = require('__stdlib__/stdlib/utils/table') +-- @usage local table = require('__stdlib2__/stdlib/utils/table') local Table = {} Table.remove = table.remove diff --git a/stdlib/vendor/enumerable.lua b/stdlib/vendor/enumerable.lua index 570de3a1..bf49f380 100644 --- a/stdlib/vendor/enumerable.lua +++ b/stdlib/vendor/enumerable.lua @@ -1,6 +1,6 @@ --- A collection library to simplify sequential table operations -- --- local Enumerable = require('__stdlib__/stdlib/vendor/enumerable') +-- local Enumerable = require('__stdlib2__/stdlib/vendor/enumerable') -- Enumerable.create({1,2,3}) -- @classmod Vendor.Enumerable -- @author Billiam