TextInput([string[, string[, integer[, integer]]]])

grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object-Free API » TextInput([string[, string[, integer[, integer]]]]) Version 2.2

説明

The TextInput Lua function opens a text input pop-up and returns the typed input as a string. It is part of the user interface functions.

引数

  • string (オプション):
    This string is the title for the pop-up. The title bar has a default "Edit" text at the beginning of the title that cannot be removed.
  • string (オプション):
    This string is the text already in the input field - can be used to provide user guidance.
  • integer (オプション):
    This integer defines a position on the x-axis where the pop-up should appear (on all screens). "0" is on the left side of the screen. Nil or undefined is centered.
  • integer (オプション):
    This integer defines a position on the y-axis where the pop-up should appear (on all screens). "0" is at the top of the screen. Nil or undefined is centered.

戻り値

  • string:
    The returned user input.

To open a text input and print the entered value in the Command Line History, create a plugin with this code:

Lua
return function()
-- Create a pop-up with the title and an input field containing some default text
-- The returned text is store in a Lua variable
local input = TextInput("This is the title","Please provide your input here")
-- Print the returned text value
Printf("You entered this message: %s",tostring(input))
end