summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lua
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-01-13 18:44:26 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-01-13 18:44:26 +0100
commitfb4695be0ab380b3c53ea8f5f64b0cc4beacd2a1 (patch)
tree7b0c2d7943bbbaa4d0fa8a56ad66fafb6cfecfad /3rdparty/lua
parentd60dc40fe37bbc90eecea9c0ebb1f932df38ab0b (diff)
Made all compile for Lua 5.3 (nw)
Diffstat (limited to '3rdparty/lua')
-rw-r--r--3rdparty/lua/src/lmathlib.c5
-rw-r--r--3rdparty/lua/src/loslib.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/3rdparty/lua/src/lmathlib.c b/3rdparty/lua/src/lmathlib.c
index 002c508bc46..f528f05d9f6 100644
--- a/3rdparty/lua/src/lmathlib.c
+++ b/3rdparty/lua/src/lmathlib.c
@@ -240,7 +240,7 @@ static int math_max (lua_State *L) {
*/
static int math_random (lua_State *L) {
lua_Integer low, up;
- double r = (double)l_rand() * (1.0 / ((double)L_RANDMAX + 1.0));
+ double r = (double)(1.0 * l_rand()) * (1.0 / ((double)L_RANDMAX + 1.0));
switch (lua_gettop(L)) { /* check number of arguments */
case 0: { /* no arguments */
lua_pushnumber(L, (lua_Number)r); /* Number between 0 and 1 */
@@ -269,7 +269,8 @@ static int math_random (lua_State *L) {
static int math_randomseed (lua_State *L) {
- l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1));
+ lua_Number seed = (lua_Number)luaL_checknumber(L, 1);
+ l_srand((unsigned int)seed);
(void)rand(); /* discard first value to avoid undesirable correlations */
return 0;
}
diff --git a/3rdparty/lua/src/loslib.c b/3rdparty/lua/src/loslib.c
index 20359b24747..d78ff757df9 100644
--- a/3rdparty/lua/src/loslib.c
+++ b/3rdparty/lua/src/loslib.c
@@ -152,7 +152,7 @@ static int os_getenv (lua_State *L) {
static int os_clock (lua_State *L) {
- lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC);
+ lua_pushnumber(L, ((lua_Number)(int)clock())/(lua_Number)CLOCKS_PER_SEC);
return 1;
}