Compare commits

..

No commits in common. 'be4f0fa98299f3b49f2438e3bb64a29e28c2290c' and '4c04718a44faa45232c92a61b645aca0e701ef54' have entirely different histories.

@ -1,6 +1,6 @@
{
"name": "lua-in-js",
"version": "2.2.5",
"version": "2.2.4",
"description": "A Lua to JS transpiler/runtime",
"keywords": [
"lua",

@ -143,8 +143,8 @@ function rad(x: LuaType): number {
function random(min?: LuaType, max?: LuaType): number {
if (min === undefined && max === undefined) return getRandom()
const firstArg = coerceArgToNumber(min, 'random', 1)
const MIN = max === undefined ? 1 : firstArg
const MAX = max === undefined ? firstArg : coerceArgToNumber(max, 'random', 2)
const MIN = max === undefined ? firstArg : 1
const MAX = max === undefined ? coerceArgToNumber(max, 'random', 2) : firstArg
if (MIN > MAX) throw new Error("bad argument #2 to 'random' (interval is empty)")
return Math.floor(getRandom() * (MAX - MIN + 1) + MIN)

Loading…
Cancel
Save