Re: Combining tabled strings
Status: Alpha
Brought to you by:
cwalther
|
From: Christian W. <cwa...@gm...> - 2011-12-09 12:09:05
|
James C. Wilson wrote:
> However, a new spanner is in the works: Pipmak still doesn't seem to
> translate the concatenation into the literal string needed. It just
> prints out the standard "Unused key 13 pressed" and does nothing when I
> press enter (the trigger for this whole thing). Note that if I replace
> the string "HELP" in the query with the raw concatenation, pipmak finds
> equality and it works.(But of course that doesn't help, cause that just
> makes Pipmak see anything the player types as being correct.)
>
> Here's the chunk that seems to be the problem:
>
> elseif key == pipmak.key_return then
> local execute = table.concat(keypress)
> if execute == "HELP" then
> pipmak.schedule(2, function()
> preScreen = pipmak.newimage(460, 340)
> preScreen:color(100, 33, 248)
> screen:setimage(preScreen)
> preScreen:drawtext(50, 90, ">:_" .. table.concat(keypress) .. "",
> "../fonts/Daniel_J_-_Deka.otf", 18, pipmak.left)
> preScreen:drawtext(50, 120, "VISITOR LOG \nMAP \nCOMMUNICATION
> \nEMERGENCY", "../fonts/Daniel_J_-_Deka.otf", 18, pipmak.left)
> screen:setimage(preScreen)
> end)
> return true
> else
> return false
> end
I see nothing wrong with that - evidently keypress is something
different than {"H", "E", "L", "P"}, but since you don't show what it is
(or how you compose it), there isn't enough information to say anything.
Try inserting a "pipmak.print(execute)" to see what's there, or if
keypress is a global variable, you can examine it using the Lua command
line (enter "keypress" and press return, then use the crosshairs on the
result to open the table inspector). (Unfortunately
"pipmak.print(keypress)" isn't helpful, as it doesn't print the contents
of the table.)
By the way, you don't need to "screen:setimage(preScreen)" twice, once
is sufficient - it's still the same image even after you draw into it.
-Christian
|