Skip to content

Commit

Permalink
GML 代码概述部分修正
Browse files Browse the repository at this point in the history
  • Loading branch information
LiarOnce committed Jul 6, 2023
1 parent 4667b83 commit c588ebd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"It is important to note that calling new on any function that has {}not{} been flagged as a constructor will cause a {}runtime exception{}.":"请务必注意,对任何{}未{}标记为构造函数的函数调用 new 将导致{}运行时异常{}。",
"The following example shows a function that has been defined to use as a constructor:":"以下示例显示了一个已定义为用作构造函数的函数:",
"The {}new{} operator can be used to create a struct with a function which is called with the given arguments. The function can then populate the struct with variables from the arguments - much like the create event of an instance will set the initial variables for the instance - and then the {}new{} operator will return the struct. Before using this operator it is important to note that the function given {}must be flagged as a {}constructor{} function{} otherwise the {}new{} operator will not create the struct (the code example below shows this, and for more information, please see the page on {}Structs{}).":"{}new{}运算可以用来用一个函数来创建一个结构,该函数会在给定参数下被调用。然后,该函数可以用参数中的变量填充该结构--就像实例的创建事件将为实例设置初始变量一样--然后{}new{}操作符将返回该结构。在使用该操作符之前,需要注意的是,给出的函数{}必须被标记为{}构造{}函数{},否则{}new{}操作符将不会创建结构(下面的代码示例显示了这一点,更多信息请参见{}结构{}页面)。",
"The {}new{} operator can be used to create a struct with a function which is called with the given arguments. The function can then populate the struct with variables from the arguments - much like the create event of an instance will set the initial variables for the instance - and then the {}new{} operator will return the struct. Before using this operator it is important to note that the function given {}must be flagged as a {}constructor{} function{} otherwise the {}new{} operator will not create the struct (the code example below shows this, and for more information, please see the page on {}Structs{}).":"{}new{} 运算可以用来用一个函数来创建一个结构,该函数会在给定参数下被调用。然后,该函数可以用参数中的变量填充该结构--就像实例的创建事件将为实例设置初始变量一样--然后 {}new{} 操作符将返回该结构。在使用该操作符之前,需要注意的是,给出的函数{}必须被标记为{}构造{}函数{},否则 {}new{} 操作符将不会创建结构(下面的代码示例显示了这一点,更多信息请参见{}结构{}页面)。",
"This function can then be used along with the {}new{} operator to create a struct and populate it with the variables set to the values of the arguments used in the function, like this:":"然后可以将此函数与 {}new{} 运算符一起使用来创建结构并使用设置为函数中使用的参数值的变量填充它,如下所示:",
"This operator has the following syntax:":"该运算符具有以下语法:",
"When you use the new operator along with a function, it will return a struct reference which is stored in the given variable, permitting you to access the struct and any variables that were created within it by the function.":"当您将 new 运算符与函数一起使用时,它将返回存储在给定变量中的结构引用,允许您访问该结构以及函数在其中创建的任何变量。",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"When a struct is no longer required it can be removed from memory using the {}{}delete{}{} operator, which flags the struct as being able to be garbage collected. This is not strictly required as the {}garbage collector{} may do this automatically if the struct is no longer referenced in your code, but it is good practice to do so and we recommend it (for example, call {}delete{} in the {}Clean Up event{} of an instance to explicitly tell the garbage collector that an instance scope struct is to be deleted). Here is an example:":"当一个结构不再需要时,可以使用{}{}delete{}{}操作符从内存中删除它,该操作符将该结构标记为能够被垃圾回收。这不是严格要求的,因为如果代码中不再引用该结构,{}垃圾收集器{}可能会自动执行此操作,但这样做是很好的实践,我们建议这样做(例如,在实例的{}清理事件{}中调用{}delete{},显式地告诉垃圾收集器要删除一个实例作用域结构)。下面是一个例子:",
"You can also make use of optional arguments in your constructor functions:":"您还可以在构造函数中使用可选参数:",
"You can also pass constant values into the parent constructor, so that a certain child constructor always provides the same values to its parent constructor:":"也可以将常量值传递给父构造函数,以便某个子构造函数始终为其父构造函数提供相同的值:",
"You can also pass values into the parent constructor, so that a certain child constructor always provides the same values to its parent constructor:":"您还可以将值传递给父构造函数,以便某个子构造函数始终向其父构造函数提供相同的值:",
"You can also perform operations on the variables within a struct or use them in functions, just as you would with any other variable. For example:":"您还可以对结构中的变量执行操作,或者在函数中使用它们,就像对待任何其他变量一样。例如:",
"You can also use {}script functions{} or {}methods{} to create functions that can be used to generate new structs, which requires the use of the {}constructor{} keyword for the function and the {}{}new{}{} operator when creating a struct from such a function. See the following function:":"您还可以使用{}脚本函数{}或{}方法{}来创建可用于生成新结构的函数,这需要使用函数的{}构造函数{}关键字,以及从此类函数创建结构时使用{}{}new{}{}运算符。请参阅以下函数:",
"You can see in the above code that you can define methods and use runtime functions in structs, and you can also use local and instance variables within the struct declaration.":"在上面的代码中可以看到,您可以在结构中定义方法和使用运行时函数,还可以在结构声明中使用局部变量和实例变量。",
Expand Down

0 comments on commit c588ebd

Please sign in to comment.