Difference between revisions of "love.textinput (한국어)"

(Created page with "{{newin|0.9.0|090|type=function}} 사용자가 텍스트를 입력했을 때 호출됩니다. 예를 들어 사용자가 시프트 2를 눌렀을 때 텍스트 "@"이 만들...")
 
m
 
(6 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
=== 리턴값 ===
 
=== 리턴값 ===
 
없음.
 
없음.
 +
== 알아 두기 ==
 +
Lua에서는 문자열을 UTF-8로 처리할 수 있긴 합니다만 대부분의 문자열 관련 함수들은 여러분이 예상한 대로 동작하진 않을 겁니다. 한 가지 예를 들자면, <code>#text</code>나 <code>string.len(text)</code>처럼 문자열의 길이를 조사할 경우 유니코드 글자수가 아니라 그 문자열의 '''바이트'''수가 조사됩니다. [http://lua-users.org/wiki/LuaUnicode Lua 위키]나[http://www.lua.org/wshop12/Ierusalimschy.pdf Lua 창시자의 프리젠테이션]에 방문하시면 여러가지 팁과 함께 자세한 설명을 얻으실 수 있습니다.
  
== Notes ==
+
== 예제 ==
Although Lua strings can store UTF-8 encoded unicode text just fine, many functions in Lua's string library will not treat the text as you might expect. For example, <code>#text</code> (and <code>string.len(text)</code>) will give the number of ''bytes'' in the string, rather than the number of unicode characters. The [http://lua-users.org/wiki/LuaUnicode Lua wiki] and a [http://www.lua.org/wshop12/Ierusalimschy.pdf presentation by one of Lua's creators] give more in-depth explanations, with some tips.
+
사용자가 입력한 텍스트를 기록하고 출력합니다.
 
 
== Examples ==
 
Record and print text the user writes.
 
 
<source lang="lua">
 
<source lang="lua">
 
function love.load()
 
function love.load()
Line 35: Line 34:
 
* [[love.keyboard.hasTextInput (한국어)]]
 
* [[love.keyboard.hasTextInput (한국어)]]
 
[[Category:Callbacks]]
 
[[Category:Callbacks]]
{{#set:Description=Called when text has been entered by the user.}}
+
{{#set:Description=사용자가 텍스트를 입력했을 때 호출됩니다.}}
 
{{#set:Subcategory=General}}
 
{{#set:Subcategory=General}}
== Other Languages ==
+
== 다른 언어 ==
 
{{i18n|love.textinput}}
 
{{i18n|love.textinput}}

Latest revision as of 23:15, 11 February 2014

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

사용자가 텍스트를 입력했을 때 호출됩니다. 예를 들어 사용자가 시프트 2를 눌렀을 때 텍스트 "@"이 만들어집니다.

함수

형식

love.textinput( text )

매개변수

string (한국어) text
UTF-8로 인코딩된 텍스트.

리턴값

없음.

알아 두기

Lua에서는 문자열을 UTF-8로 처리할 수 있긴 합니다만 대부분의 문자열 관련 함수들은 여러분이 예상한 대로 동작하진 않을 겁니다. 한 가지 예를 들자면, #textstring.len(text)처럼 문자열의 길이를 조사할 경우 유니코드 글자수가 아니라 그 문자열의 바이트수가 조사됩니다. Lua 위키Lua 창시자의 프리젠테이션에 방문하시면 여러가지 팁과 함께 자세한 설명을 얻으실 수 있습니다.

예제

사용자가 입력한 텍스트를 기록하고 출력합니다.

function love.load()
    text = "Type away! -- "
end

function love.textinput(t)
    text = text .. t
end

function love.draw()
    love.graphics.printf(text, 0, 0, love.graphics.getWidth())
end

같이 보기


다른 언어