Module:UtilsVar

local p = {}

local binser = require("binser")

function p.set(name, val) local var = binser.serialize(val) mw.getCurrentFrame:callParserFunction("#vardefine", name, var) end

function p.get(name) local var = mw.getCurrentFrame:callParserFunction("#var", name) local val = binser.deserialize(var)[1] return val end

function p.counter(name) name = name or "" return { increment = function local val = p.get(name) or 0 val = val + 1 p.set(name, val) end, value = function return p.get(name) or 0 end } end

return p