Jump to content
Our Domain Name Has Changed! Read more... ×
Sclerocephalus

God dammit Bethesda, or: why the Lakeview Manor weapon rack can't be fixed

Recommended Posts

The compiler does little or no error checking. We learned that with value(less) returns in value returning functions. My guess is this is a relatively smart guy, who had heard of recursive descent compilers, but never formally took a class.

 

Errr... actually, the valueless "return" works in the same way as you probably know it from other programming languages. I recently needed to have a look at this myself because I was somewhat confused about the use of it in some scripts from recent mods. I also remember that I had read a comment on the CK Wiki stating that "return" without a return value passes only due to a bug in the papyrus compiler (and saying between the lines that this actually won't work). Though, this comment doesn't exist anymore. Instead, it does now read as follows (implying that it does work anyway):

 

http://www.creationkit.com/Return_%28Papyrus%29#Return_Statement

Share this post


Link to post
Share on other sites

Unless I'm missing something it's saying an empty return in a function that, for example, should return bool will instead return None. Which would be bad, yes?

Share this post


Link to post
Share on other sites

Unless I'm missing something it's saying an empty return in a function that, for example, should return bool will instead return None. Which would be bad, yes?

 

"If a function with a return type exits without a return statement, then None will be returned"

 

The case of a function with a return type exiting with an empty return is not covered by the comment, but I remember vaguely that this resulted in a compiler error.

Share this post


Link to post
Share on other sites

The case of a function with a return type exiting with an empty return is not covered by the comment, but I remember vaguely that this resulted in a compiler error.

You can of course test this yourself, but no -- there is no compiler error. I submitted a whole raft of these hand checked for bool, and they've been fixed. That immediately fixed a bunch of oddball bugs!

 

Someday, I'll look for missing int returns....

Share this post


Link to post
Share on other sites
[08/17/2013 - 01:48:42AM] Error: Unable to call RegisterForSingleUpdate - no native object bound to the script object, or object is of incorrect type
stack:
    [None]._StarMain.RegisterForSingleUpdate() - "<native>" Line ?
    [None]._StarMain.OnUpdate() - "_StarMain.psc" Line ?

I triple dog dare someone to come up with an explanation for that. Hana just got it in a log tonight.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Support us on Patreon!

×