StringValue

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

StringValue 는 Lua 문자열을 하나의 Lua 문자열으로 저장하는 목적을 위한 개체입니다. 문자열의 길이는 200,000자를 초과할 수 없습니다(이는 "문자열이 너무 깁니다"오류를 일으킵니다). 모든 "-Value" 개체와 마��

속성 창의 값 필드에 문자열이 너무 깁니다면 앞에 있는 하이픈(...)이 표시되는 부분에 문자열 내용이 일부 표시됩니다.

코드 샘플

This sample demonstrates the subtleties of the Changed event on normal objects and "-Value" objects.

Changed Event

-- Demonstrate the Changed event by creating a Part
local part = Instance.new("Part")
part.Changed:Connect(print)
-- This fires Changed with "Transparency"
part.Transparency = 0.5
-- Similarly, this fires Changed with "Number"
part.Name = "SomePart"
-- Since changing BrickColor will also change other
-- properties at the same time, this line fires Changed
-- with "BrickColor", "Color3" and "Color3uint16".
part.BrickColor = BrickColor.Red()
-- A NumberValue holds a double-precision floating-point number
local vNumber = Instance.new("NumberValue")
vNumber.Changed:Connect(print)
-- This fires Changed with 123.456 (not "Value")
vNumber.Value = 123.456
-- This does not fire Changed
vNumber.Name = "SomeNumber"
-- A StringValue stores one string
local vString = Instance.new("StringValue")
vString.Changed:Connect(print)
-- This fires Changed with "Hello" (not "Value")
vString.Value = "Hello"

속성

Value

병렬 읽기

저장된 문자열 .

메서드

이벤트

Changed

Class.StringValue.Value의 새로운 값이 변경될 때마다 발생합니다. 새로운 값이 문자열 개체 대신 인수 개체에 저장되므로 문자열이 변경되는 대신 실행됩니다.

이 이벤트는 다른 변경된 이벤트와 마찬가지로 문자열 값이 변경될 때 추적하고 변경될 수 있는 다른 값을 추적하는 데 사용할 수 있습니다.This event, like other changed events, can be used to track when a StringValue changes and to track the different values that it may change to.

예를 인스턴스, 이 메서드는 NPC 또는 아이템 이름과 같은 값을 추적하기 위해 문자열 값을 사용하는 게임에서 유용할 수 있습니다.

변경된 이벤트는 대상, 예를 들어 NumberValueBoolValue 와 같은 유사한 개체에 대해 변경된 이벤트가 있습니다. 필요에 가장 적합한 개체 유형에 따라 Class.NumberValue 및 2>Class.BooleanValue2> 가 있습니다.

매개 변수

value: string

변경 후의 새 값.


코드 샘플

The below example, assuming all referenced objects existed, would print the StringValue's new value each time it changed. In the example below it would print "Hello world!".

How to Use StringValue.Changed

local value = Instance.new("StringValue")
value.Parent = workspace
value.Changed:Connect(function(NewValue)
print(NewValue)
end)
value.Value = "Hello world!"