aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-03-09 16:24:45 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-03-09 16:24:45 -0300
commit9e3db70482e927e5992cccdb5a40424b33ad0a29 (patch)
treef1ef266d0fed005ff73723c6cfa607c041db7432
parentdbec41f34ca26f4762bbda3c6e99ba227508d743 (diff)
downloadlua-9e3db70482e927e5992cccdb5a40424b33ad0a29.tar.gz
lua-9e3db70482e927e5992cccdb5a40424b33ad0a29.tar.bz2
lua-9e3db70482e927e5992cccdb5a40424b33ad0a29.zip
details (casts between 'lua_Number' and 'double')
-rw-r--r--ltests.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ltests.c b/ltests.c
index a5781fb6..bc8b6b43 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.241 2018/02/20 16:52:50 roberto Exp roberto $ 2** $Id: ltests.c,v 2.242 2018/02/23 13:13:31 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -957,13 +957,13 @@ static int doonnewstack (lua_State *L) {
957 957
958 958
959static int s2d (lua_State *L) { 959static int s2d (lua_State *L) {
960 lua_pushnumber(L, *cast(const double *, luaL_checkstring(L, 1))); 960 lua_pushnumber(L, cast_num(*cast(const double *, luaL_checkstring(L, 1))));
961 return 1; 961 return 1;
962} 962}
963 963
964 964
965static int d2s (lua_State *L) { 965static int d2s (lua_State *L) {
966 double d = luaL_checknumber(L, 1); 966 double d = cast(double, luaL_checknumber(L, 1));
967 lua_pushlstring(L, cast_charp(&d), sizeof(d)); 967 lua_pushlstring(L, cast_charp(&d), sizeof(d));
968 return 1; 968 return 1;
969} 969}