You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Thank you for great project!
I'm trying to make bundle from project with a lot of files but with external lualib. But didn't find any possible way. Is it possible?
Hello!
I think you could set luaLibImport equal to none. See: https://typescripttolua.github.io/docs/configuration
Then, you could make sure that the things like __TS__Class and so on are set as global variables and defined elsewhere before your code runs.
However, I am not 100% sure if this is a good solution for your particular project though, I would need more context as to what you are trying to do.
I'm developing programs for computers in minecraft with OpenComputers mod.
Hard drives and RAM there have very limited size (up to 4MB for hard drivers, up to 1.5MB for memory sticks)
Current bundle contains a copy of lualib which sizes ~80kb (and ~80kb in memory).
Each bundle, loaded in memory, contains it's own copy of luabundle. Loading 4 programs at once will consume ~320kb bcs of lualib included.
Removing lualib from bundle saved for me ~240kb bcs of sharing lualib between programs.
Also my plugin saved 50kb of space and 30kb of memory due to smaller variable names.
I want to run several programs at once so that change will save for me a lot of space and memory.
Activity
Zamiell commentedon May 8, 2025
Hello!
I think you could set
luaLibImportequal tonone. See: https://typescripttolua.github.io/docs/configurationThen, you could make sure that the things like
__TS__Classand so on are set as global variables and defined elsewhere before your code runs.However, I am not 100% sure if this is a good solution for your particular project though, I would need more context as to what you are trying to do.
inklesspen1rus commentedon May 8, 2025
Sadly but I can't predefine exports from lualib.
My ides is bundle which imports lualib from environment, i.e.
require('lualib_bundle')luaLibImport = nonemakes bundle do not require lualib at allZamiell commentedon May 8, 2025
if you want to require it then can you set
luaLibImporttorequire?inklesspen1rus commentedon May 8, 2025
No, then bundle includes lualib that's not that I'm trying to get
Zamiell commentedon May 8, 2025
You can just delete the lualib file afterward though with a script, right? (Assuming you are not bundling to a single file.)
inklesspen1rus commentedon May 8, 2025
Probably I'm bad in english so you're misunderstanding me
I'll show example
Here is my test project:
project.zip
I want to get this bundle (with no lualib included but
require('lualib')still exists:good_bundle.txt
But TSTL produces me this (lualib included):
bad_bundle.txt
inklesspen1rus commentedon May 8, 2025
Well I resolved that for me with a small plugin
Looks not so good and it additionaly minifies bundle but that works
Perryvw commentedon May 8, 2025
What is the reason you don't want to include the lualib into your bundle?
inklesspen1rus commentedon May 8, 2025
I'm developing programs for computers in minecraft with OpenComputers mod.
Hard drives and RAM there have very limited size (up to 4MB for hard drivers, up to 1.5MB for memory sticks)
Current bundle contains a copy of lualib which sizes ~80kb (and ~80kb in memory).
Each bundle, loaded in memory, contains it's own copy of luabundle. Loading 4 programs at once will consume ~320kb bcs of lualib included.
Removing lualib from bundle saved for me ~240kb bcs of sharing lualib between programs.
Also my plugin saved 50kb of space and 30kb of memory due to smaller variable names.
I want to run several programs at once so that change will save for me a lot of space and memory.
inklesspen1rus commentedon May 8, 2025
Also I want to distribute my programs easily, ideally just one file.