Jump to content

Trying to use GetString causing a crash?


Recommended Posts

If you're trying to access it from modmain, then you need to either localize it:

local GetString = GLOBAL.GetString
...
str = GetString(...)

or use it directly:

str = GLOBAL.GetString(...)

 

Link to comment
Share on other sites

7 minutes ago, Muche said:

If you're trying to access it from modmain, then you need to either localize it:


local GetString = GLOBAL.GetString
...
str = GetString(...)

or use it directly:


str = GLOBAL.GetString(...)

 

I guess I could have just tried that. Is there some kind of rhyme or reason to what is or isn't readily available without localization, or do you just have to trial-and-error it?

Link to comment
Share on other sites

Environment available in mod's modmain.lua (and modworldgenmain.lua) is created in mods.lua|CreateEnvironment() and modutil.lua|InsertPostInitFunctions(). Anything that isn't added into it explicitly, has to be accessed via GLOBAL (which incidentally is one of the fields made available in there).

Edited by Muche
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...