absurdor

Files related to my duties are Absurdor of Agora Nomic
Log | Files | Refs

record.lua (997B)


      1 local record = {}
      2 
      3 record.push = function(f, args, log)
      4 	f:write(string.format("%s pushed the boulder at %s\n", args.who, os.date("!%Y-%m-%d %H:%M %z", args.when)))
      5 	table.insert(log, {
      6 					 when = args.when,
      7 					 what = "push",
      8 					 who = args.who,
      9 					 where = args.where
     10 	})
     11 end
     12 
     13 record.transfer = function(f, args, log)
     14 	f:write(string.format("%s transfered the Veblen to emself for %d spendies.\n", args.who, args.payed))
     15 	table.insert(log, {
     16 		when = args.when,
     17 		what = "transfer",
     18 		who = args.who,
     19 		where = args.where,
     20 		payed = args.payed
     21 	})
     22 end
     23 
     24 record.devalue = function(f, args, log)
     25 	local val = 1
     26 	local max = 0
     27 	for _,e in ipairs(log) do
     28 		if e.what == "report" and e.when > max then
     29 			max = e.when
     30 			val = e.cost
     31 		end
     32 	end
     33 
     34 	f:write(string.format("%s devalued the Veblen to %d spendies.\n", args.who, math.ceil(val/2)))
     35 	table.insert(log, {
     36 		when = args.when,
     37 		what = "devalue",
     38 		who = args.who,
     39 		where = args.where,
     40 		value = math.ceil(val/2)
     41 	})
     42 end
     43 
     44 return record