Skip to content

Commit

Permalink
Moved require impl globals to require.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Avril112113 committed Apr 24, 2024
1 parent 4902973 commit 5e39e4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
3 changes: 3 additions & 0 deletions tool/src/require.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
__SSSWTOOL_REQUIRES = {}
__SSSWTOOL_MOD_TO_FILEPATH = {}
__SSSWTOOL_RESULTS = {}
function require(modpath)
if __SSSWTOOL_RESULTS[modpath] == nil then
__SSSWTOOL_RESULTS[modpath] = __SSSWTOOL_REQUIRES[modpath](modpath, __SSSWTOOL_MOD_TO_FILEPATH[modpath])
Expand Down
18 changes: 0 additions & 18 deletions tool/transform_lua_to_swaddon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@ function TransformerDefs:_add_require(node, func_node, modpath, filepath)

block = ASTNodes.block(source,
ASTNodes.LineComment(source, "--", "#region SSSWTool-Require-src"),
ASTNodes.assign(source, nil,
ASTNodes.namelist(source,
ASTNodes.name(source, "__SSSWTOOL_REQUIRES")),
ASTNodes.expressionlist(source, ASTNodes.table(source, ASTNodes.fieldlist(source))
)
),
ASTNodes.assign(source, nil,
ASTNodes.namelist(source,
ASTNodes.name(source, "__SSSWTOOL_MOD_TO_FILEPATH")),
ASTNodes.expressionlist(source, ASTNodes.table(source, ASTNodes.fieldlist(source))
)
),
ASTNodes.assign(source, nil,
ASTNodes.namelist(source,
ASTNodes.name(source, "__SSSWTOOL_RESULTS")),
ASTNodes.expressionlist(source, ASTNodes.table(source, ASTNodes.fieldlist(source))
)
),
require_src_ast,
ASTNodes.LineComment(source, "--", "#endregion")
)
Expand Down

0 comments on commit 5e39e4a

Please sign in to comment.