Jump to content
Toggle menu
  • 3.1K articles
  • 4.4K files
  • 18 users
  • 91.5K edits
Ashenzari's Archive
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:String: Difference between revisions

From Ashenzari's Archive
imported>CommanderC
No edit summary
imported>CommanderC
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
   
   
-- Used in Template:Monster by Property:Hit_dice
function p.first_word(frame)
function p.first_word(frame)
   local text = frame.args[1]
   local text = frame.args[1]
Line 8: Line 9:
end
end


-- Used in Template:Monster by Property:Monster_magic_resistance
function p.fix_magic_resistance(frame)
function p.fix_magic_resistance(frame)
   local text = frame.args[1]
   local text = frame.args[1]
Line 16: Line 18:
end
end


-- Used in Template:Monster by Property:Monster_size
function p.fix_monster_size(frame)
function p.fix_monster_size(frame)
   local text = frame.args[1]
   local text = frame.args[1]
Line 25: Line 28:
end
end


-- Used in Template:Monster by Property:Monster_intelligence
function p.fix_monster_intelligence(frame)
function p.fix_monster_intelligence(frame)
   return p.fix_monster_size(frame)
   return p.fix_monster_size(frame)

Revision as of 16:45, 29 November 2013

local p = {}

-- Used in Template:Monster by Property:Hit_dice function p.first_word(frame)

 local text = frame.args[1]
 for token in string.gmatch(text, "[^%s]+") do
   return token
 end

end

-- Used in Template:Monster by Property:Monster_magic_resistance function p.fix_magic_resistance(frame)

 local text = frame.args[1]
 if text == "Immune" or text == "immune" then
   return "1000"
 end
 return text

end

-- Used in Template:Monster by Property:Monster_size function p.fix_monster_size(frame)

 local text = frame.args[1]
 found, _, token = string.find(text, "|([^%]]+)%]")
 if found then
   return token
 end
 return text

end

-- Used in Template:Monster by Property:Monster_intelligence function p.fix_monster_intelligence(frame)

 return p.fix_monster_size(frame)

end

return p