-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
37 lines (28 loc) · 1 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
================================================================================
dice.lua - A dice rolling module useful for bell curve type random distributions
================================================================================
(c)2011 Shaun Sullivan
Electric Plum, LLC
www.electricplum.com
twitter: @LiquidSullivan
email: shaun@electricplum.com
Please use freely in any of your projects!
Example usage:
local dice = require("dice")
-- Most compact method roll 4d6 and subtract 2 from the roll
local dRoller = dice.new({dice=4, sides=6, adjust=-2})
dRoller.roll()
local dRoller = dice.new()
-- Roll 3 6 sided dice and add 1 to the result (string method)
local roll = dRoller.rollFromDiceString("3d6+1")
print("roll = "..tostring(roll))
-- Add 3 8 sided dice and one 12 and then roll
dRoller.reset()
dRoller.addMultipleDice(3, 8)
dRoller.addDie(12)
roll = dRoller.roll()
print("roll = "..roll)
-- Roll 4 10-sided dice and add 6 to the total
for i=1,10 do
print(dRoller.rollFromDiceString("4d10+6"))
end