Skip to content

Commit

Permalink
Update AutomaticWeaponRemoval.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
SecretX33 committed Jan 2, 2021
1 parent a84a215 commit 9920acb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions AutomaticWeaponRemoval.lua
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,13 @@ local function trim(s)
return string.match(s,'^()%s*$') and '' or string.match(s,'^%s*(.*%S)')
end

local function removeWords(myString, numberOfWords)
if (myString~=nil and numberOfWords~=nil) then
local function removeWords(myString, howMany)
if (myString~=nil and howMany~=nil) then
assert(type(myString) == "string", "bad argument #1: 'myString' needs to be a string; instead what came was " .. tostring(type(myString)))
assert(type(numberOfWords) == "number", "bad argument #2: 'numberOfWords' needs to be a table; instead what came was " .. tostring(type(numberOfWords)))
assert(math.floor(numberOfWords) == numberOfWords, "bad argument #2: 'numberOfWords' needs to be an integer")
assert(type(howMany) == "number", "bad argument #2: 'howMany' needs to be a number; instead what came was " .. tostring(type(howMany)))
assert(math.floor(howMany) == howMany, "bad argument #2: 'howMany' needs to be an integer")

for i=1, numberOfWords do
for i=1, howMany do
myString = string.gsub(myString,"^(%s*%a+)","",1)
end
return trim(myString)
Expand Down

0 comments on commit 9920acb

Please sign in to comment.