isaacscript-common 1.0.603 → 1.0.604
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/globals.d.ts +14 -2
- package/dist/functions/globals.lua +36 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/package.json +1 -1
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get a set containing all of the global variable names that are contained
|
|
4
|
+
* within the Isaac environment by default.
|
|
5
|
+
*
|
|
6
|
+
* Returns a slightly different set depending on whether the "--luadebug" flag is enabled or not.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDefaultGlobals(): Set<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to get an array of any added global variables in the Isaac Lua environment.
|
|
11
|
+
* Returns an array of key/value tuples.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getNewGlobals(): [AnyNotNil, unknown][];
|
|
14
|
+
export declare function logNewGlobals(): void;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
|
|
4
|
+
local ____log = require("functions.log")
|
|
5
|
+
local log = ____log.log
|
|
6
|
+
local ____util = require("functions.util")
|
|
7
|
+
local combineSets = ____util.combineSets
|
|
8
|
+
local isLuaDebugEnabled = ____util.isLuaDebugEnabled
|
|
9
|
+
local DEFAULT_GLOBALS = __TS__New(Set, {
|
|
5
10
|
"ActionTriggers",
|
|
6
11
|
"ActiveSlot",
|
|
7
12
|
"BabySubType",
|
|
@@ -167,5 +172,34 @@ ____exports.DEFAULT_GLOBALS = __TS__New(Set, {
|
|
|
167
172
|
"utf8",
|
|
168
173
|
"xpcall"
|
|
169
174
|
})
|
|
170
|
-
|
|
175
|
+
local LUA_DEBUG_ADDED_GLOBALS = __TS__New(Set, {"debug", "io", "os", "package"})
|
|
176
|
+
function ____exports.getDefaultGlobals(self)
|
|
177
|
+
return isLuaDebugEnabled(nil) and combineSets(nil, DEFAULT_GLOBALS, LUA_DEBUG_ADDED_GLOBALS) or DEFAULT_GLOBALS
|
|
178
|
+
end
|
|
179
|
+
function ____exports.getNewGlobals(self)
|
|
180
|
+
local defaultGlobals = ____exports.getDefaultGlobals(nil)
|
|
181
|
+
local newGlobals = {}
|
|
182
|
+
for key, value in pairs(_G) do
|
|
183
|
+
if not defaultGlobals:has(key) then
|
|
184
|
+
local keyValueTuple = {key, value}
|
|
185
|
+
__TS__ArrayPush(newGlobals, keyValueTuple)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
return newGlobals
|
|
189
|
+
end
|
|
190
|
+
function ____exports.logNewGlobals(self)
|
|
191
|
+
local newGlobals = ____exports.getNewGlobals(nil)
|
|
192
|
+
log("List of added global variables in the Isaac environment:")
|
|
193
|
+
if #newGlobals == 0 then
|
|
194
|
+
log("- n/a (no extra global variables found)")
|
|
195
|
+
end
|
|
196
|
+
do
|
|
197
|
+
local i = 0
|
|
198
|
+
while i < #newGlobals do
|
|
199
|
+
local key, value = table.unpack(newGlobals[i + 1])
|
|
200
|
+
log((((tostring(i + 1) .. ") ") .. tostring(key)) .. " - ") .. tostring(value))
|
|
201
|
+
i = i + 1
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
end
|
|
171
205
|
return ____exports
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./functions/doors";
|
|
|
23
23
|
export * from "./functions/entity";
|
|
24
24
|
export * from "./functions/familiars";
|
|
25
25
|
export * from "./functions/flag";
|
|
26
|
+
export * from "./functions/globals";
|
|
26
27
|
export * from "./functions/gridEntity";
|
|
27
28
|
export * from "./functions/input";
|
|
28
29
|
export * from "./functions/json";
|
package/dist/index.lua
CHANGED
|
@@ -190,6 +190,14 @@ do
|
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
|
+
do
|
|
194
|
+
local ____export = require("functions.globals")
|
|
195
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
196
|
+
if ____exportKey ~= "default" then
|
|
197
|
+
____exports[____exportKey] = ____exportValue
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
193
201
|
do
|
|
194
202
|
local ____export = require("functions.gridEntity")
|
|
195
203
|
for ____exportKey, ____exportValue in pairs(____export) do
|