Substr minparam ?

Started by Zigo, December 08, 2010, 06:22:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zigo

Hi !
I've got recently a problem with the substr function. I have this error:
Quoteerror: Incorrect number of parameters. Function: SUBSTR MinParams: 2. (")")
This is happening when I use substr to truncate a string:
[code language="bennu" options="singleline"]txt=substr(txt,-3);[/code]

In the wiki, this code is used in the example, but I have the same error when I try to compile it. I remember this code was running with older version of Bennu.
Perhaps this is a new bug with the recently Bennu released.
Is somebody have the same problem ?
Thanks

PS: sorry for my english I am french  :)

FreeYourMind

Bienvenue à votre TERREUR!


handsource-dyko

You need 3 parameters. I guess the function may have changed, the wiki says
that in the pre-bennu versions (fenix 0.92) this function works slightly different.

I don't know of any bug, I've used substring myself, although I don't do very
fancy things with it.

Zigo

I found the origin of the bug !
I used a bad bgdc.import with my program: mod_string was not written in the file !
But the error is still intriguing: the error message is not the good error message. BGDC must say that it don't recognize substr instead of a MinParams error.
???

FreeYourMind

You need to import mod_string for string functions.

SplinterGU

for message error, the problem is...

- if the functions aren't written before the use, then they are autodefined, then any command used is autodefined as function... then when you use it with 2 different syntax, then you obtain this error.
- if you use this function in whole code with an unique syntax, and you don't define it in your code, because it's a module functions, then you'll have error "don't recognize"

I hate autodefine functionality.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Zigo