mirror of https://github.com/rusefi/lua.git
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
|
** Standard Operating System library
|
||||||
** See Copyright Notice in lua.h
|
** 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) {
|
static void setfield (lua_State *L, const char *key, int value) {
|
||||||
lua_pushstring(L, key);
|
|
||||||
lua_pushinteger(L, value);
|
lua_pushinteger(L, value);
|
||||||
lua_rawset(L, -3);
|
lua_setfield(L, -2, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setboolfield (lua_State *L, const char *key, int value) {
|
static void setboolfield (lua_State *L, const char *key, int value) {
|
||||||
lua_pushstring(L, key);
|
|
||||||
lua_pushboolean(L, value);
|
lua_pushboolean(L, value);
|
||||||
lua_rawset(L, -3);
|
lua_setfield(L, -2, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getboolfield (lua_State *L, const char *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
|
** Configuration file for Lua
|
||||||
** See Copyright Notice in lua.h
|
** 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 */
|
/* function to convert a lua_Number to a string */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
|
#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 */
|
/* function to convert a string to a lua_Number */
|
||||||
#define lua_str2number(s,p) strtod((s), (p))
|
#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
|
** Lua virtual machine
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -47,7 +47,7 @@ int luaV_tostring (lua_State *L, StkId obj) {
|
||||||
if (!ttisnumber(obj))
|
if (!ttisnumber(obj))
|
||||||
return 0;
|
return 0;
|
||||||
else {
|
else {
|
||||||
char s[32]; /* 16 digits, sign, point and \0 (+ some extra...) */
|
char s[MAX_NUMBER2STR];
|
||||||
lua_number2str(s, nvalue(obj));
|
lua_number2str(s, nvalue(obj));
|
||||||
setsvalue2s(L, obj, luaS_new(L, s));
|
setsvalue2s(L, obj, luaS_new(L, s));
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue