Skip to content

Commit c2cbbc6

Browse files
tweak: vector cvt2str
Required for backwards compatibility.
1 parent 8a031c2 commit c2cbbc6

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "lstate.h"
2828
#include "lstring.h"
2929
#include "lvm.h"
30+
#include "lglm_core.h"
3031

3132

3233
/*
@@ -372,8 +373,8 @@ static int tostringbuff (TValue *obj, char *buff) {
372373
** Convert a number object to a Lua string, replacing the value at 'obj'
373374
*/
374375
void luaO_tostring (lua_State *L, TValue *obj) {
375-
char buff[MAXNUMBER2STR];
376-
int len = tostringbuff(obj, buff);
376+
char buff[256]; /* size must be greater than: 11 + (4 * MAXNUMBER2STR) */
377+
int len = ttisvector(obj) ? glmVec_tostr(obj, buff, sizeof(buff)) : tostringbuff(obj, buff);
377378
setsvalue(L, obj, luaS_newlstr(L, buff, len));
378379
}
379380

lvm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
#if !defined(LUA_NOCVTN2S)
17-
#define cvt2str(o) ttisnumber(o)
17+
#define cvt2str(o) (ttisnumber(o) || ttisvector(o))
1818
#else
1919
#define cvt2str(o) 0 /* no conversion from numbers to strings */
2020
#endif

0 commit comments

Comments
 (0)