Jump to content

Module:Sandbox/SD0001/Chess pgn

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SD0001 (talk | contribs) at 03:44, 31 December 2023. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local pgnModule = require('Module:Pgn')
local getArgs = require('Module:Arguments').getArgs

local p = {}

p.pgnToFen = function (frame)
	local args = getArgs(frame) 
	local pgn = args.pgn
	metadata, moves = pgnModule.main(pgn)
	local halfmoves = args.halfmoves or #moves
	return moves[halfmoves]
end

return p