Is there a way to append to a script instead of directly setting source?

I made a plugin for my game that creates a Lua module holding a bunch of data that needs to be accessed for loading my maps.

According to google:

Lua can process text strings in excess of 230,000 characters , which allows the formatted contents of article pages to be used as input to string searches. However, there have been some limitations in string contents, such as hidden strings enclosed in nowiki-tag or pre-tag elements.

Now, the issue I am running into is that the module being generated exceeds this 230K character limit (it is a huge file) which is triggering an error and thus not allowing the plugin to work.

One solution (aside from attempting to compress the data) that I could come up with was appending the data in chunks similar to how many beginner implementations of UDP and TCP packet listeners work.

Unfortunately I didnt see any append option in the wiki.

Is it possible to append to a file (not doing script.Source = script.Source + chunkOfText)?

No, you can’t append to the Source of a script. You could try a loadstring-based solution (messy solution), or splitting it up into more modules (the better solution), but there’s not really any direct way to work around the issue.

2 Likes