Binding of Isaac: Rebirth Wiki
Binding of Isaac: Rebirth Wiki
m
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
local p = {}
 
local p = {}
   
local bit32 = require( 'bit32' )
+
local w_bit = require( 'module:bit' )
 
 
local w_frame = require( 'module:frame' )
 
local w_frame = require( 'module:frame' )
   
Line 25: Line 24:
 
for str in mw.text.gsplit( args[1], '▼' ) do
 
for str in mw.text.gsplit( args[1], '▼' ) do
 
parts = mw.text.split( str, '►' )
 
parts = mw.text.split( str, '►' )
if bit32.band( tonumber( parts[1] ), filter ) > 0 then
+
if w_bit['and']{ parts[1], filter } > 0 then
 
return parts[2]
 
return parts[2]
 
end
 
end

Latest revision as of 10:07, 3 May 2021


local p = {}

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