aboutsummaryrefslogtreecommitdiff
path: root/src/lib_string.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib_string.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/lib_string.c b/src/lib_string.c
index b955e933..ec01594f 100644
--- a/src/lib_string.c
+++ b/src/lib_string.c
@@ -655,26 +655,7 @@ static GCstr *string_fmt_tostring(lua_State *L, int arg, int retry)
655 copyTV(L, L->base+arg-1, --L->top); 655 copyTV(L, L->base+arg-1, --L->top);
656 return NULL; /* Buffer may be overwritten, retry. */ 656 return NULL; /* Buffer may be overwritten, retry. */
657 } 657 }
658 if (tvisnumber(o)) { 658 return lj_strfmt_obj(L, o);
659 return lj_str_fromnumber(L, o);
660 } else if (tvisnil(o)) {
661 return lj_str_newlit(L, "nil");
662 } else if (tvisfalse(o)) {
663 return lj_str_newlit(L, "false");
664 } else if (tvistrue(o)) {
665 return lj_str_newlit(L, "true");
666 } else {
667 char buf[8+2+2+16], *p = buf;
668 if (tvisfunc(o) && isffunc(funcV(o))) {
669 p = lj_buf_wmem(p, "function: builtin#", 18);
670 p = lj_str_bufint(p, funcV(o)->c.ffid);
671 } else {
672 p = lj_buf_wmem(p, lj_typename(o), strlen(lj_typename(o)));
673 *p++ = ':'; *p++ = ' ';
674 p = lj_str_bufptr(p, lua_topointer(L, arg));
675 }
676 return lj_str_new(L, buf, (size_t)(p - buf));
677 }
678} 659}
679 660
680LJLIB_CF(string_format) 661LJLIB_CF(string_format)
@@ -734,7 +715,7 @@ again:
734 break; 715 break;
735 case STRFMT_PTR: /* No formatting. */ 716 case STRFMT_PTR: /* No formatting. */
736 setsbufP(sb, lj_str_bufptr(lj_buf_more(sb, LJ_STR_PTRBUF), 717 setsbufP(sb, lj_str_bufptr(lj_buf_more(sb, LJ_STR_PTRBUF),
737 lua_topointer(L, arg))); 718 lj_obj_ptr(L->base+arg-1)));
738 break; 719 break;
739 default: 720 default:
740 lua_assert(0); 721 lua_assert(0);