generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: String.find()

Previous Thread :: Next Thread 
WolfgangVonPrinz is not online. WolfgangVonPrinz
Joined: 24 Oct 2013
Total Posts: 4656
28 Feb 2016 02:01 PM
Me error m8 " for i in string.gmatch(testString, "%S+") do -- Getting t:4: bad argument #1 to 'find' (string expected, got nil)"

n' me c0de m8

testString = "cats d0gs dsjodajodjsalkdsaj23dsh GOTTMITTSUNS"

function check(strng)
local test = string.find(strng, "%p or %d%")
if not test then
return true
end
print('test' .. test)
end
function manipulateString(strng)
local words = {}
for i in string.gmatch(testString, "%S+") do -- Getting the indivdual words
table.insert(words, i)
end
local longestWord = nil
for i,v in pairs(words) do
if check(v)then
if longestWord then -- Comparing with current record
print(v .. " " .. longestWord)
if string.len(v) > string.len(longestWord) then
print 'Didn"t error!'
longestWord = v
end
else
longestWord = v
end
else
print('rejected ' .. v)
end

end
end

manipulateString(testString)
Report Abuse
WolfgangVonPrinz is not online. WolfgangVonPrinz
Joined: 24 Oct 2013
Total Posts: 4656
28 Feb 2016 03:09 PM
Love me!
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
28 Feb 2016 03:15 PM
It works fine.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image