|
Post by wmerussi on May 18, 2017 13:28:59 GMT
I'm having issues trying to concatenate a variable with a string.
This is my code:
function checkMonster(monster)
monsterFacingLeft = Pattern(monster + "-left.png")
monsterFacingRight = Pattern(monster + "-right.png") end
checkMonster("assassin") This code alone already gives me the error: attempt to perform arithmetic on local 'monster' (a string value).
Then I tried str(monster) but gives me the error: attempt to call global 'str' (a nil value).
When I check for the type of the variable monster it returns me string.
The reason I need this is because the game has a left and a right pattern and I'd like to use only one function to check for both patterns.
How may I concatenate it properly? Thanks!
|
|
|
Post by AnkuLua on May 18, 2017 13:30:52 GMT
monster .. "-left.png"
|
|
|
Post by wmerussi on May 18, 2017 13:34:19 GMT
Thank you so much! It works!!
|
|