Skip to content

Modules: Can I override mixins? #5357

Answered by zach2good
hookstar asked this question in Q&A
Discussion options

You must be logged in to vote

To understand why this doesn't work, you have to understand a) how Lua loads and caches items requested through require, b) how we load and cache things, and in what order, and c) how mixins are loaded and applied.

(in the old style of requiring IDs, but is a good example of the point I'm explaining)

local ID = require("scripts/zones/Northern_San_dOria/IDs")

https://www.lua.org/pil/8.1.html

TLDR; require loads a file into an internal cache based on the path string you've looked it up with, and then returns that object from the cache if you ask for it again. This internal cache is the package.loaded object. You can clear things out of the cache by setting entries in there to nil. We do thi…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@hookstar
Comment options

Comment options

You must be logged in to vote
6 replies
@WinterSolstice8
Comment options

@hookstar
Comment options

@hookstar
Comment options

@zach2good
Comment options

Answer selected by zach2good
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants