2,732
edits
Red Leader (talk | contribs) m (Grammar) |
Red Leader (talk | contribs) (→getText(): Doc) |
||
Line 6: | Line 6: | ||
== Functions == | == Functions == | ||
=== getText() === | === getText() === | ||
{{Nasal doc | |||
|syntax = clipboard.getText([type]); | |||
|source = {{simgear file|simgear/nasal/mathlib.c|l=196|t=Source}} | |||
|text = Returns the contents of the clipboard as a string. | |||
|param1 = type | |||
|param1text = Optional argument that specifies the source of the text. If <code>clipboard.CLIPBOARD</code> (the default) is given, the contents of the clipboard are returned. If <code>clipboard.SELECTION</code> is given, the contents of the selection buffer are given. Note that only X11 systems properly implement <code>clipboard.SELECTION</code>, but this argument may still be used with [[#setText()|setText]] (see example 2). | |||
|example1 = var text = clipboard.getText(); # make sure you copy some text first | |||
print("'", text, "'"); | |||
|example2 = clipboard.setText("Demo", clipboard.SELECTION); | |||
var text = clipboard.getText(clipboard.SELECTION); | |||
print("'", text, "'"); # prints 'Demo' | |||
}} | |||
=== setText() === | === setText() === | ||