Binding of Isaac: Rebirth Wiki
m (Remove unused require)
mNo edit summary
Line 3: Line 3:
 
--local w_bit = require( 'module:bit' )
 
--local w_bit = require( 'module:bit' )
 
local w_frame = require( 'module:frame' )
 
local w_frame = require( 'module:frame' )
 
local data = mw.loadData( 'module:dlc/data' )
   
   
 
function p.parse( f )
 
function p.parse( f )
return mw.loadData( 'module:dlc/data' ).values[w_frame.args( f )[1] or ''] or 0
+
return data.values[w_frame.args( f )[1] or ''] or 0
 
end
 
end
   
Line 12: Line 13:
 
function p.test( f )
 
function p.test( f )
 
local args = w_frame.args( f )
 
local args = w_frame.args( f )
return ( mw.loadData( 'module:dlc/data' ).test[tonumber( args[1] )] or {} )[tonumber( args[2] ) or 15] or 0
+
return ( data.test[tonumber( args[1] )] or {} )[tonumber( args[2] ) or 15] or 0
 
--[[
 
--[[
 
local value = args[1]
 
local value = args[1]
 
local context = args[2]
 
local context = args[2]
local data = mw.loadData( 'module:dlc/data' )
 
 
 
 
if context == 15 then
 
if context == 15 then

Revision as of 21:07, 28 April 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
	--[[
	local value   = args[1]
	local context = args[2]
	
	if context == 15 then
		return value
	end
	
	local filtered = w_bit['and']{ value, context }
	if filtered == 0 then
		return 0
	end
	
	if w_bit['or']{ value, context } == value then
		return 15
	end
	
	local limits = w_bit['and']{ 9, filtered }
	if limits == value then
	    return limits
	end
	]]
end


return p