Combine to strings

Hey guys,

I just want to combine two strings. For examble:

String1=“Test”
String2=“String”

String3= String1 and " " and String2 doesn’t work… (the result should be: String3=“Test String”)

Whats the correct syntax?!

From memory (I can’t test at the moment) it’s a double full stop

String3=String1.." "..String2

Use …


Like s = "Hello".." World"

Thanks a lot for the fast answer.

I got another little question:

How can i Identity the return and the delete Key in the keyboard(Key) function?!

This is how I do it…


function keyboard(key)
    if key ~= nil then
        if string.byte(key) == 10 then
            -- return key
        elseif string.byte(key) == nil then
            -- backspace
        else
            -- some other key
        end
    end
end

You can also use this.


function setup()
    showKeyboard()
end

function draw()
    background(40, 40, 50)
end

function keyboard(key)
    if key == RETURN then
        print("RETURN")
    elseif key == BACKSPACE then
        print("BACKSPACE")
    else
        print(key)
    end
end

Ha! I never knew those constants were in there. (sigh) I’ve been making things harder than they needed to be.

Awesome. Thanks a lot!