Lua Script Migration

From PMDOWiki
Revision as of 18:29, 9 June 2024 by IDK (talk | contribs) (stub)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Between 0.8.1 and 0.8.2, the lua scripting system has changed. When you reserialize mods between these versions, the lua scripts will go through an automatic conversion.


In the new system, lua scripts are diff modded. This means that instead of having to replace the entire file in the base game, you can chose to just add or redefine functions that you want.

For example...


This works on common, init, include, and event scripts on the top level (as well as the scripts they call), ground map scripts, and zone scripts.

Services behave slightly differently: they used to . Now they .


However, this means that your mod must include the common scripts yourself.

Before you could just override common_vars, and the base game's common.lua would call it.

Now you have to load it yourself.


init.lua must require common, event, and include


Additionally, all lua scripts are namespaced. This way, you can reference methods from the base game specifically. The caveat is that all scripts need to be moved.



Lua scripts are saved in a subfolder based on the mod's namespace.

References to require "common" become require "origin.common"

MapStrings is deprecated. This means the initial variable declaration is removed


the initialization method is removed

And Instead, use STRINGS.MapStrings