MidrealmDM Posted January 20, 2019 Share Posted January 20, 2019 I have these line in Modmain.lua ================ W101_FLOAT = 0 if GLOBAL.IsDLCEnabled(GLOBAL.CAPY_DLC) or GLOBAL.IsDLCEnabled(GLOBAL.PORKLAND_DLC) then W101_FLOAT=1 end ================ Then In one of several prefabs ================ if W101_FLOAT ==1 then .... ================ However, when the prefab is loaded, the game crashes with the error that the variable is not defined My knowledge of Lua is limited, and I am sure I am missing something iimportant in the way that Lua works.. Any help would be appreciated. Link to comment Share on other sites More sharing options...
CarlZalph Posted January 20, 2019 Share Posted January 20, 2019 This would probably be both strict.lua being mean and the scope of the variable. In modmain: GLOBAL.global("W101_FLOAT") -- For strict.lua to be happy, declares this as a global GLOBAL.W101_FLOAT = 1 Prefab: if _G.W101_FLOAT == 1 then -- _G should be defined here, if not then use GLOBAL. This forces the global context scope Link to comment Share on other sites More sharing options...
MidrealmDM Posted January 20, 2019 Author Share Posted January 20, 2019 Thank much... that helped a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.