kevin ver
kevin ver

Reputation: 851

Attempt to call field 'defaultName' (a string value) error

I'm getting a strange Attempt to call field 'defaultName' (a string value) when i add " some more text " to my code below:

--
alert = native.showAlert( "saved!",  "Your score is saved to " ..defaultName " some more text " ..allScore_txt , { "Done" }, onComplete )
--

any idea how to fix this ?

Upvotes: 1

Views: 3015

Answers (1)

lhf
lhf

Reputation: 72312

You missed a .. after defaultName and so Lua thinks you mean a function call, hence the error message. Lua allows function calls in the form identifier"string" as shorthand for identifier("string")`.

Upvotes: 4

Related Questions