CraftTweaker

CraftTweaker

151M Downloads

[Bug/Request] isNull for oreDict in map

justinrusso opened this issue ยท 2 comments

commented

Intro:

I would like to be able to check if a value of an IOreDictEntry[string] map is null.

Issue Description:

Currently isNull does not seem to work for IOreDictEntry. It works on IItemStack, but I need support for IOreDictEntry or some other solution to check if the value of the map is null. When using on IOreDictEntry it gives me the error parameter count mismatch: got 1 arguments

Script used

global metals as IOreDictEntry[string][string] = {
	abyssalnite: {
		block: <ore:blockAbyssalnite>,
		dust: <ore:dustAbyssalnite>,
		gear: null,
		ingot: <ore:ingotAbyssalnite>,
		nugget: <ore:nuggetAbyssalnite>,
		plate: null,
		rod: null
	},
};

if (isNull(metals.abyssalnite.gear)) {
	//do stuff
}
commented

Or for the purpose I need at least, a mapName.containsKey(); would work as well

commented

Figured out a way - metals.abyssalnite.gear as bool will return true if not null, and false if null.