Advertisement
stom66

TTS Lua | Save input field to description

May 22nd, 2023 (edited)
2,199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | Source Code | 0 0
  1. function onLoad()
  2.     -- First remove the existing inputs on the object
  3.     self.clearInputs()
  4.  
  5.     -- Next, recreate the input. The text value is taken from the object memo field
  6.     self.createInput({
  7.         input_function = "save_value_to_description",
  8.         function_owner = self,
  9.         label          = "Enter your description",
  10.         alignment      = 2,
  11.         position       = {x=0, y=1, z=0},
  12.         width          = 800,
  13.         height         = 300,
  14.         font_size      = 64,
  15.         font_color     = {r=0, g=0, b=0},
  16.         color          = {r=0, g=0, b=0},
  17.         text           = self.memo
  18.     })
  19. end
  20.  
  21. function save_value_to_description(obj, color, input, stillEditing)
  22.     -- When a user finishes editing the input field, copy the text to the object
  23.     -- memo field so it can be retrieved later
  24.     if not stillEditing then
  25.         self.memo = input
  26.     end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement