Bennu Game Development

English Forums => General => Topic started by: Zigo on December 08, 2010, 06:22:05 PM

Title: Substr minparam ?
Post by: Zigo on December 08, 2010, 06:22:05 PM
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  :)
Title: Re: Substr minparam ?
Post by: FreeYourMind on December 08, 2010, 07:26:13 PM
Bienvenue à votre TERREUR!

(http://zomblog.zombies.fr/public/Films%20zombis/Manoir_de_la_Terreur/Manoir_de_la_terreur04.jpg)
Title: Re: Substr minparam ?
Post by: handsource-dyko on December 08, 2010, 07:57:12 PM
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.
Title: Re: Substr minparam ?
Post by: Zigo on December 08, 2010, 09:29:24 PM
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.
???
Title: Re: Substr minparam ?
Post by: FreeYourMind on December 08, 2010, 10:12:21 PM
You need to import mod_string for string functions.
Title: Re: Substr minparam ?
Post by: SplinterGU on December 08, 2010, 10:20:01 PM
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.
Title: Re: Substr minparam ?
Post by: Zigo on December 09, 2010, 06:30:09 PM
Ok, thanks !