random(10); -- is the same as rn2(10); */ random(5,8); -- same as 5 + rn2(8); */
| 937 | /* random(10); -- is the same as rn2(10); */ |
| 938 | /* random(5,8); -- same as 5 + rn2(8); */ |
| 939 | staticfn int |
| 940 | nhl_random(lua_State *L) |
| 941 | { |
| 942 | int argc = lua_gettop(L); |
| 943 | |
| 944 | if (argc == 1) |
| 945 | lua_pushinteger(L, rn2((int) luaL_checkinteger(L, 1))); |
| 946 | else if (argc == 2) |
| 947 | lua_pushinteger(L, luaL_checkinteger(L, 1) |
| 948 | + rn2((int) luaL_checkinteger(L, 2))); |
| 949 | else |
| 950 | nhl_error(L, "Wrong args"); |
| 951 | |
| 952 | return 1; |
| 953 | } |
| 954 | |
| 955 | /* level_difficulty() */ |
| 956 | staticfn int |