News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

script wizard and assert()

Started by LETARTARE, June 11, 2013, 10:43:50 AM

Previous topic - Next topic

LETARTARE

hello,
in the Squirrel 3.0 reference manuel found :

Quoteassert(exp)
throws an exception if exp is null

is that this function is available in the wizard scripts ?

if not, how to raise an exception in a wizard script?

thank you.
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

oBFusCATed

As far as I know we're still using squirrel 2.x, so you have to check its manual.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

LETARTARE

thank you for the answer.

Squirrel 2.2  is identical ...

Quoteassert(exp)
throws an exception if exp is null



CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

oBFusCATed

OK. Have you tried it?
What do you expect to happen?
Who is going to catch it?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

LETARTARE

QuoteOK. Have you tried it?
yes with my configuration
QuoteWhat do you expect to happen?
crash Code::Blocks !!!
QuoteWho is going to catch it?
I do not know, this is why I ask questions?
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

oBFusCATed

Quote from: LETARTARE on June 11, 2013, 11:08:15 AM
crash Code::Blocks !!!
Why?
But I'm sure it won't happen, probably you'll get an error in the log or it will be silently ignored.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

LETARTARE

#6
I think I misunderstood
QuoteWhat do you expect to happen?
in fact, this is what happened during the test
local board = null;
assert(board)


This exception should be recovered by "Code::Blocks" to notify the user ?
This is not the case.
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

oBFusCATed

I don't understand sorry. Please explain better or provide a sample script.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

ollydbg

Quote from: LETARTARE on June 11, 2013, 12:24:55 PM
local board = null;
assert(board)

This exception should be recovered by "Code::Blocks" to notify the user ?
I tried the code in "Scripting console", there will pop an error message box, and no crash of C::B.
Quote
Welcome to the script console!
> local board = null;
> assert(board)

AN ERROR HAS OCCURED [the index 'board' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE

AN ERROR HAS OCCURED [the index 'board' does not exist]

CALLSTACK
*FUNCTION [main()] ScriptConsole line [1]

LOCALS
[this] TABLE
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

If I add the code in a project wizard script, then I see a message box said: script error has occurred, please press yes to see the exact errors.

Then I click Yes, there will be a dialog to show the detailed error messages. Still no crash of C::B.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

LETARTARE

@ollydbg
thank you very much for taking the time to check these two lines of code.

So I try on the other machine with the same configuration, and I confirm your results: we get the warning messages.

I incriminates my first PC, I'll check.

Thank you again for the constructive responses
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'