From 7dfa4cd655118faf164427356609fec31906dac2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 14 Apr 2010 12:13:48 -0300 Subject: first implementation of light C functions --- ltests.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index b8276ce5..58fcb5b9 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 2.92 2010/04/12 12:42:07 roberto Exp roberto $ +** $Id: ltests.c,v 2.93 2010/04/12 16:07:39 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -191,7 +191,7 @@ static void printobj (global_State *g, GCObject *o) { GCObject *p; for (p = g->allgc; p != o && p != NULL; p = gch(p)->next) i++; if (p == NULL) i = -1; - printf("%d:%s(%p)-%c(%02X)", i, typename(gch(o)->tt), (void *)o, + printf("%d:%s(%p)-%c(%02X)", i, ttypename(gch(o)->tt), (void *)o, isdead(g,o)?'d':isblack(o)?'b':iswhite(o)?'w':'g', gch(o)->marked); } @@ -519,7 +519,7 @@ static int mem_query (lua_State *L) { const char *t = luaL_checkstring(L, 1); int i; for (i = LUA_NUMTAGS - 1; i >= 0; i--) { - if (strcmp(t, typename(i)) == 0) { + if (strcmp(t, ttypename(i)) == 0) { lua_pushinteger(L, l_memcontrol.objcount[i]); return 1; } @@ -944,6 +944,9 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { else if EQ("tonumber") { lua_pushnumber(L1, lua_tonumber(L1, getindex)); } + else if EQ("topointer") { + lua_pushlightuserdata(L1, cast(void *, lua_topointer(L1, getindex))); + } else if EQ("tostring") { const char *s = lua_tostring(L1, getindex); const char *s1 = lua_pushstring(L1, s); -- cgit v1.2.3-55-g6feb