Combining tabled strings
Status: Alpha
Brought to you by:
cwalther
From: James C. W. <jfc...@ya...> - 2012-01-11 01:23:18
|
Looks like my response a couple weeks ago never got through for some reason, sorry. Resending. So actually that "if" problem was just a typo on my part, sorry. 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 Thanks, James CW --- On Wed, 11/30/11, Christian Walther <cwa...@gm...> wrote: >From: Christian Walther <cwa...@gm...> >Subject: Re: Combining tabled strings >To: pip...@li... >Date: Wednesday, November 30, 2011, 3:48 PM > > >James C. Wilson wrote: >> local execute = ""..keypress[1]..""..keypress[2]..""..keypress[3].. >> ""..keypress[4].. ""..keypress[5].. ""..keypress[6].. ""..keypress[7].. >> ""..keypress[8].. ""..keypress[9].. ""..keypress[10].. "" >> >> if execute == "map" then > >Works for me. By the way, you don't need all these empty strings - this >works too: > > local execute = keypress[1]..keypress[2]..keypress[3].. > keypress[4]..keypress[5]..keypress[6]..keypress[7]..keypress[8].. > keypress[9]..keypress[10] > >And if you want to save some typing, or handle variable-sized lists, a >shorter version is > > local execute = table.concat(keypress) > >(see http://www.lua.org/manual/5.0/manual.html#5.4 ) > >> I receive an "unexpected symbol near "if" error. > >That suggests that there is something wrong with what comes before the >"if" - Lua is not expecting an "if" there, but something that completes >whatever comes before. > > -Christian > > >------------------------------------------------------------------------------ >All the data continuously generated in your IT infrastructure >contains a definitive record of customers, application performance, >security threats, fraudulent activity, and more. Splunk takes this >data and makes sense of it. IT sense. And common sense. >http://p.sf.net/sfu/splunk-novd2d >_______________________________________________ >Pipmak-Users mailing list >Pip...@li... >news://news.gmane.org/gmane.games.devel.pipmak.user >https://lists.sourceforge.net/lists/listinfo/pipmak-users > |