Binding of Isaac: Rebirth Wiki
Binding of Isaac: Rebirth Wiki

local p = {}

local bit32 = require( 'bit32' )

local w_bit = require( 'module:bit' )
local w_frame = require( 'module:frame' )

local data = mw.loadData( 'module:dlc/data' )


function p.parse( f )
	return data.values[w_frame.args( f )[1] or ''] or 0
end


function p.test( f )
	local args = w_frame.args( f )
	return ( data.test[tonumber( args[1] )] or {} )[tonumber( args[2] ) or 15] or 0
end


function p.find( f )
	local args   = w_frame.args( f )
	local filter = args[2] == 'last' and 8 or args[2] or tonumber( mw.getCurrentFrame():callParserFunction( '#var:context' ) ) or 15
	local parts
	for str in mw.text.gsplit( args[1], '▼' ) do
		parts = mw.text.split( str, '►' )
		if w_bit['and']{ parts[1], filter } > 0 then
			return parts[2]
		end
	end
end


return p