Difference between revisions of "TES5Edit Scripting Functions"
Jump to navigation
Jump to search
→Pascal implementation: correction: JvInterpreter!Delphi's handling of global variables is just atrocious in every way, and Delphi itself isn't any help
imported>DavidJCobb (→Pascal implementation: JvInterpreter doesn't support static variables properly and is terrible in general) |
imported>DavidJCobb (→Pascal implementation: correction: JvInterpreter!Delphi's handling of global variables is just atrocious in every way, and Delphi itself isn't any help) |
||
Line 834: | Line 834: | ||
* TES5Edit's Pascal implementation does not appear to support constructions such as <code>TList<Integer></code>. | * TES5Edit's Pascal implementation does not appear to support constructions such as <code>TList<Integer></code>. | ||
* If you try to store a Variant (e.g. the return value of GetElementNativeValues) in a Float variable and that variant has returned <code>nil</code>, then that Float will also contain <code>nil</code> and will throw errors when used. | * If you try to store a Variant (e.g. the return value of GetElementNativeValues) in a Float variable and that variant has returned <code>nil</code>, then that Float will also contain <code>nil</code> and will throw errors when used. | ||
* JvInterpreter | * JvInterpreter throws an error if any identifiers in the global scope are redeclared; reportedly, this differs from the behavior that Delphi has shown since 1987, wherein global identifiers in later-included files shadow those in earlier-included files. Defining them in <code>implementation</code> blocks doesn't make any difference. | ||
** This may be a standard Delphi limitation if [http://stackoverflow.com/questions/11258996/delphi-xe-dcc-error-e2004-identifier-redeclared-system the behavior of the System unit] is of any indication, but literally no official or unofficial documentation on the Internet mentions it as a general rule. | ** In addition to this, including a unit multiple times triggers these errors, as its own definitions conflict with themselves. This may be a standard Delphi limitation if [http://stackoverflow.com/questions/11258996/delphi-xe-dcc-error-e2004-identifier-redeclared-system the behavior of the System unit] is of any indication, but literally no official or unofficial documentation on the Internet mentions it as a general rule. | ||
*** And no, Delphi has no equivalent to <code>#pragma once</code>, and JvInterpreter wouldn't support it anyway | |||
* According to Delphi documentation across the web, Const directives inside of functions and procedures are supposed to define static local variables: these variables are not supposed to be constants, and their values are supposed to persist until the script has finished executing. However, in JvInterpreter, Const directives in functions and procedures just define ordinary local variables, whose values will be lost the instant the function or procedure finishes executing. Among other things, this means you can't use getters with static variables to work around the issues with global variables. | * According to Delphi documentation across the web, Const directives inside of functions and procedures are supposed to define static local variables: these variables are not supposed to be constants, and their values are supposed to persist until the script has finished executing. However, in JvInterpreter, Const directives in functions and procedures just define ordinary local variables, whose values will be lost the instant the function or procedure finishes executing. Among other things, this means you can't use getters with static variables to work around the issues with global variables. | ||