Ace Attorney Wiki

Editing

Module:Table

1
  • The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit. If you are undoing an edit that is …
Latest revision Your text
Line 3: Line 3:
 
local p = {}
 
local p = {}
   
local function delimiterPositions(wikitable, delimiter, ender)
+
local function delimiterPositions(wikitable, delimiter)
 
-- Gets the positions and number of instances of a delimiter in a table's wikitext. By "position", we mean that, for example, the letter "e" in "hello" is in position 2, and the pattern "ll" in "hello" is in position 3.
 
-- Gets the positions and number of instances of a delimiter in a table's wikitext. By "position", we mean that, for example, the letter "e" in "hello" is in position 2, and the pattern "ll" in "hello" is in position 3.
 
local positions = {}
 
local positions = {}
Line 12: Line 12:
 
positions[index] = pos
 
positions[index] = pos
 
index = index + 1
 
index = index + 1
elseif string.sub(wikitable, pos, pos + string.len(ender) - 1) == ender then
 
positions[index] = pos
 
break
 
 
end
 
end
 
end
 
end
  +
  +
positions[index] = string.len(wikitable) - 1
   
 
return {positions, index - 1}
 
return {positions, index - 1}
Line 23: Line 22:
 
local function rowPositions(wikitable)
 
local function rowPositions(wikitable)
 
-- Gets the positions of instances of the row delimiter |- in a table's wikitext.
 
-- Gets the positions of instances of the row delimiter |- in a table's wikitext.
return delimiterPositions(wikitable, "|-", "|}")[1]
+
return delimiterPositions(wikitable, "|-")[1]
 
end
 
end
   
 
local function rows(wikitable)
 
local function rows(wikitable)
 
-- Gets the number of rows in a table's wikitext.
 
-- Gets the number of rows in a table's wikitext.
return delimiterPositions(wikitable, "|-", "|}")[2]
+
return delimiterPositions(wikitable, "|-")[2]
 
end
 
end
   
  Loading editor
Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above.

View this template