Expose core random number functions to lua

Expose nh.rn2() and nh.random() to lua.
Add a math.random() compatibility shim to nhlib.lua
This commit is contained in:
Pasi Kallinen
2020-03-25 12:24:02 +02:00
parent c8fb419a2c
commit eec9c2e209
3 changed files with 66 additions and 1 deletions

View File

@@ -158,6 +158,23 @@ Example:
nh.pline("Message text to show.");
=== random
Generate a random number.
Example:
nh.random(10); -- returns a number between 0 and 9, inclusive.
nh.random(1,5); -- same as 1 + nh.random(5);
=== rn2
Generate a random number.
Example:
nh.rn2(10); -- returns a number between 0 and 9, inclusive.
=== s_suffix
Return a string converted to possessive.