mirror of
https://github.com/lua/lua.git
synced 2025-02-04 06:13:04 +08:00
details
This commit is contained in:
parent
280f7becb8
commit
1a343814d8
10
lapi.c
10
lapi.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.44 2005/07/05 14:30:31 roberto Exp roberto $
|
** $Id: lapi.c,v 2.45 2005/07/06 18:07:30 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -113,11 +113,11 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
|
|||||||
if (from == to) return;
|
if (from == to) return;
|
||||||
lua_lock(to);
|
lua_lock(to);
|
||||||
api_checknelems(from, n);
|
api_checknelems(from, n);
|
||||||
api_check(L, G(from) == G(to));
|
api_check(from, G(from) == G(to));
|
||||||
|
api_check(from, to->ci->top - to->top >= n);
|
||||||
from->top -= n;
|
from->top -= n;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
setobj2s(to, to->top, from->top + i);
|
setobj2s(to, to->top++, from->top + i);
|
||||||
api_incr_top(to);
|
|
||||||
}
|
}
|
||||||
lua_unlock(to);
|
lua_unlock(to);
|
||||||
}
|
}
|
||||||
@ -975,9 +975,9 @@ LUA_API int lua_next (lua_State *L, int idx) {
|
|||||||
|
|
||||||
LUA_API void lua_concat (lua_State *L, int n) {
|
LUA_API void lua_concat (lua_State *L, int n) {
|
||||||
lua_lock(L);
|
lua_lock(L);
|
||||||
luaC_checkGC(L);
|
|
||||||
api_checknelems(L, n);
|
api_checknelems(L, n);
|
||||||
if (n >= 2) {
|
if (n >= 2) {
|
||||||
|
luaC_checkGC(L);
|
||||||
luaV_concat(L, n, cast(int, L->top - L->base) - 1);
|
luaV_concat(L, n, cast(int, L->top - L->base) - 1);
|
||||||
L->top -= (n-1);
|
L->top -= (n-1);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lobject.c,v 2.15 2005/05/31 14:25:18 roberto Exp roberto $
|
** $Id: lobject.c,v 2.16 2005/07/11 14:00:14 roberto Exp roberto $
|
||||||
** Some generic functions over Lua objects
|
** Some generic functions over Lua objects
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -89,11 +89,10 @@ int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
|
|||||||
|
|
||||||
int luaO_str2d (const char *s, lua_Number *result) {
|
int luaO_str2d (const char *s, lua_Number *result) {
|
||||||
char *endptr;
|
char *endptr;
|
||||||
lua_Number res = lua_str2number(s, &endptr);
|
*result = lua_str2number(s, &endptr);
|
||||||
if (endptr == s) return 0; /* no conversion */
|
if (endptr == s) return 0; /* conversion failed */
|
||||||
while (isspace(cast(unsigned char, *endptr))) endptr++;
|
while (isspace(cast(unsigned char, *endptr))) endptr++;
|
||||||
if (*endptr != '\0') return 0; /* invalid trailing characters? */
|
if (*endptr != '\0') return 0; /* invalid trailing characters? */
|
||||||
*result = res;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user