summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/lstrlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/lstrlib.c')
-rw-r--r--apps/plugins/lua/lstrlib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/plugins/lua/lstrlib.c b/apps/plugins/lua/lstrlib.c
index 3d6103692f..8b39314e93 100644
--- a/apps/plugins/lua/lstrlib.c
+++ b/apps/plugins/lua/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ 2** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -754,6 +754,7 @@ static void addintlen (char *form) {
754 754
755 755
756static int str_format (lua_State *L) { 756static int str_format (lua_State *L) {
757 int top = lua_gettop(L);
757 int arg = 1; 758 int arg = 1;
758 size_t sfl; 759 size_t sfl;
759 const char *strfrmt = luaL_checklstring(L, arg, &sfl); 760 const char *strfrmt = luaL_checklstring(L, arg, &sfl);
@@ -768,7 +769,8 @@ static int str_format (lua_State *L) {
768 else { /* format item */ 769 else { /* format item */
769 char form[MAX_FORMAT]; /* to store the format (`%...') */ 770 char form[MAX_FORMAT]; /* to store the format (`%...') */
770 char buff[MAX_ITEM]; /* to store the formatted item */ 771 char buff[MAX_ITEM]; /* to store the formatted item */
771 arg++; 772 if (++arg > top)
773 luaL_argerror(L, arg, "no value");
772 strfrmt = scanformat(L, strfrmt, form); 774 strfrmt = scanformat(L, strfrmt, form);
773 switch (*strfrmt++) { 775 switch (*strfrmt++) {
774 case 'c': { 776 case 'c': {
@@ -785,11 +787,13 @@ static int str_format (lua_State *L) {
785 snprintf(buff, MAX_ITEM, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); 787 snprintf(buff, MAX_ITEM, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
786 break; 788 break;
787 } 789 }
790#if 0 /* ROCKLUA NO FLOATING POINT */
788 case 'e': case 'E': case 'f': 791 case 'e': case 'E': case 'f':
789 case 'g': case 'G': { 792 case 'g': case 'G': {
790 snprintf(buff, MAX_ITEM, form, (double)luaL_checknumber(L, arg)); 793 snprintf(buff, MAX_ITEM, form, (double)luaL_checknumber(L, arg));
791 break; 794 break;
792 } 795 }
796#endif
793 case 'q': { 797 case 'q': {
794 addquoted(L, &b, arg); 798 addquoted(L, &b, arg);
795 continue; /* skip the 'addsize' at the end */ 799 continue; /* skip the 'addsize' at the end */