mirror of
https://github.com/lua/lua
synced 2025-04-07 05:22:57 +03:00
detail
This commit is contained in:
parent
8ddfe3df29
commit
a72fbf794d
8
loslib.c
8
loslib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: loslib.c,v 1.2 2004/08/05 19:30:37 roberto Exp roberto $
|
||||
** $Id: loslib.c,v 1.3 2004/10/08 18:57:16 roberto Exp roberto $
|
||||
** Standard Operating System library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -91,15 +91,13 @@ static int io_clock (lua_State *L) {
|
||||
*/
|
||||
|
||||
static void setfield (lua_State *L, const char *key, int value) {
|
||||
lua_pushstring(L, key);
|
||||
lua_pushinteger(L, value);
|
||||
lua_rawset(L, -3);
|
||||
lua_setfield(L, -2, key);
|
||||
}
|
||||
|
||||
static void setboolfield (lua_State *L, const char *key, int value) {
|
||||
lua_pushstring(L, key);
|
||||
lua_pushboolean(L, value);
|
||||
lua_rawset(L, -3);
|
||||
lua_setfield(L, -2, key);
|
||||
}
|
||||
|
||||
static int getboolfield (lua_State *L, const char *key) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: luaconf.h,v 1.25 2005/01/10 16:31:30 roberto Exp roberto $
|
||||
** $Id: luaconf.h,v 1.26 2005/01/10 18:17:39 roberto Exp roberto $
|
||||
** Configuration file for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -237,6 +237,8 @@ __inline int l_lrint (double flt)
|
||||
/* function to convert a lua_Number to a string */
|
||||
#include <stdio.h>
|
||||
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
|
||||
/* maximum size of previous conversion */
|
||||
#define MAX_NUMBER2STR 32 /* 16 digits, sign, point and \0 (+ some extra) */
|
||||
|
||||
/* function to convert a string to a lua_Number */
|
||||
#define lua_str2number(s,p) strtod((s), (p))
|
||||
|
4
lvm.c
4
lvm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 2.21 2005/01/07 20:00:33 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.22 2005/01/10 18:17:39 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -47,7 +47,7 @@ int luaV_tostring (lua_State *L, StkId obj) {
|
||||
if (!ttisnumber(obj))
|
||||
return 0;
|
||||
else {
|
||||
char s[32]; /* 16 digits, sign, point and \0 (+ some extra...) */
|
||||
char s[MAX_NUMBER2STR];
|
||||
lua_number2str(s, nvalue(obj));
|
||||
setsvalue2s(L, obj, luaS_new(L, s));
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user