Jump to content

[RESOLVED] A userdata value?


Turbesz

Recommended Posts

why not working this? (sorry, but me very very noob "scripter")

local GUIEditor = { 
    button = {}, 
    window = {}, 
    memo = {} 
} 
  
local szoveg = {} 
  
        GUIEditor.window[1] = guiCreateWindow(675, 322, 317, 305, "teszt panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        szoveg = guiCreateMemo(13, 23, 294, 223, "", false, GUIEditor.window[1]) 
        GUIEditor.button[1] = guiCreateButton(33, 255, 257, 40, "ok", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
         
addEventHandler("onClientGUIClick", GUIEditor.button[1], 
outputChatBox("Szöveg "..szoveg.." még szöveg") 
) 

and... ERROR: xy.lua:15: attempt to concatenate global 'szoveg' (a userdata value)

Edited by Guest
Link to comment
local GUIEditor = { 
    button = {}, 
    window = {}, 
    memo = {} 
}  
  
        GUIEditor.window[1] = guiCreateWindow(675, 322, 317, 305, "teszt panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        szoveg = guiCreateMemo(13, 23, 294, 223, "", false, GUIEditor.window[1]) 
        GUIEditor.button[1] = guiCreateButton(33, 255, 257, 40, "ok", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
        
addEventHandler("onClientGUIClick", GUIEditor.button[1], function() 
outputChatBox("Szöveg "..guiGetText(szoveg).." még szöveg") 
) 
end) 
  

Link to comment

NeverGiveup gave, I presume a working chunk of code but didn't explain what was wrong:

szoveg is the element returned from guiCreateMemo and you tried concatenating that element into a string, which cannot be done. You need to use guiGetText which will get all of the text from the GUI element which is in your case the memo.

Also you define szoveg as a table to begin with, you didn't need to do that, you could've just done this:

  
local szoveg = guiCreateMemo(13, 23, 294, 223, "", false, GUIEditor.window[1]) 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...