layer_get_name


描述

You can use this function to get the name of the given layer. You supply the unique layer ID value and if the layer is one of the named layers created in the room editor, then the function will return a string with the layer name. If the layer is not one of the room editor ones (ie: it was created using layer_create) then an empty string will be returned.


语法:

layer_get_name(layer_id)


参数:

参数 描述
layer_id The unique ID value of the layer to get the name of


返回:

String(字符串)


例如:

var a = layer_get_all();
var layer_list = ds_list_create(); for (var i = 0; i Alt; array_length_1d(a); i++;)
   {
   if layer_get_name(a[i]) != ""
      {
      ds_list_add(layer_list, a[i])
      }
   }

The above code gets the IDs for all the layers in the room and then loops though them checking to see if any are named layers. If they are they are then their ID is added to a list.


上一页: General Layer Functions
next: layer_get_all
© Copyright YoYo Games Ltd. 2018 All Rights Reserved