I'm a doctor, not a mechanic

Difference between revisions of "UnrealScript Feature Recommendations"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m
(Replaced content with '{{delete}}')
 
Line 1: Line 1:
==What is this page for?==
+
{{delete}}
This page is here to promote discussion amongst UScripters about what features they would like to see added to UScript. When posting suggestions to this page you must have the understanding that these recommendations are purely that, they are not expectations, so with that do not expect these things to be added (also consider this when discussing/criticizing others suggestions).
+
<br>
+
Please try to keep your recommendations within reason I do think a realistic approach is best, thank you.
+
 
+
==Namespaces==
+
'''pro's'''
+
interfaces/class names can be defined with macros
+
package.group.class strucutre already exists
+
...more on this later
+
 
+
 
+
==Block Scope variable definitions==
+
 
+
'''This:'''<uscript>
+
function NoBlockScope()
+
{
+
local Object Obj;
+
+
foreach ObjArray(Obj)
+
{
+
//Obj is accessible here
+
}
+
//Obj is defined and is accessible in this scope
+
}</uscript>
+
 
+
'''Would become:'''<uscript>
+
function BlockScope()
+
{
+
foreach ObjArray(local Object Obj)
+
{
+
//Obj is accessible here
+
}
+
//Obj is not defined and inaccessible in this scope
+
}</uscript>
+
'''The local keyword could be replaced with var, block or just omitted entirely. Similarly this would work for any type as in the following:'''<uscript>
+
function BlockScopeTwo()
+
{
+
foreach ObjArray(var Object Obj, var int i)
+
{
+
//Obj and i are only accessible here
+
}
+
//Obj and i are not defined and inaccessible in this scope
+
}</uscript>
+
 
+
===Default variable assignment===
+
'''This:'''<uscript>
+
function bool CheckReplacement(Actor Other)
+
{
+
local Controller C;
+
+
C = Controller(Other);
+
 
+
if(C != None)
+
{
+
//do something here
+
}
+
}</uscript>
+
'''Would become:'''<uscript>
+
function bool CheckReplacement(Actor Other)
+
{
+
local Controller C = Controller(Other);
+
+
if(C != None)
+
{
+
//do something here
+
}
+
}</uscript>
+
'''The following example is of both block scope and default variable assignment:'''
+
<uscript>
+
function BlockScopeThree()
+
{
+
for(local int i = 0; i < A.length; ++i)
+
{
+
//do something here
+
}
+
}</uscript>
+
====Casting as type====
+
<uscript>
+
function bool CheckReplacement(Actor Other)
+
{
+
local Controller(Other) C;
+
+
if(C != None)
+
{
+
//do something here
+
}
+
}</uscript>
+
====Accessor====
+
<uscript>
+
var Pawn Pawn;
+
var Pawn.Controller Controller; // Pawn must have a subobject Controller right?
+
 
+
</uscript>
+
 
+
==Triplet type==
+
A type that can only be one of the following, constructed from 2 boolean types, one which denoted the value of either 0 or 1 and the other which denotes the sign being a negative or positive. There is infact a possibility for a negative zero.
+
<pre>-1,0,1</pre>
+
===Updates to normal()===
+
Using the aforementioned Triplet type one can construct a truple which can be used as a [[wp:unit vector|unit vector]]. This way input into the normal() would be a type conversion and allow for a more correct literal.
+
=== <=> Operator===
+
With this type its possible to implement this binary relationship operator [[wp:Space Ship Operator|Space Ship Operator]] as in perl, ruby and groovy programming languages.
+
<br>
+
[[Category:Programming articles]]
+

Latest revision as of 09:01, 23 June 2010