User talk:Matroc

For Loop a -z
local c = "" for x = string.byte('a'), string.byte('z') do   c = c .. string.char(x)                          -- 'a' to 'z end

Length of a String
test = "This is a string" length = #test or length = test:len

Combine tables together
newtable = {} t1 = {"Alabama", "New York"} t2 = {"New Hampshire", "Vermont"} for k,v in ipairs(t1) do table.insert(newtable, v) end for k,v in ipairs(t2) do table.insert(newtable, v) end -- newtable now has both t1 and t2 --- can do this for multiple tables

Trim white space left
string = string:match'^%s*(.*)'

Trim white space right
string = string:match'^(.*%S)'

Trim both left and right
string = string:match'^%s*(.*%S)'

Is a table
if (type(var) == "table") then do table work else do non-table work end

Pad to left of String
test = "Some String" char="." len=40 test = test .. string.rep(char, len - #test)

Pad to right of String
test = "Some String" char ="." len = 40 test = string.rep(char, len - #test) .. test

Chop to length
test = "This is a test" test = test:sub(1,5)
 * can pad left or right to insure size is fixed
 * may wish to trim spaces off right and left as well

Reverse a String
test = "This is a test" test = test:reverse

Str left
test = "This is a test" test = test:sub(1,count)
 * Have to make decision as in case of count being greater than the length of a string or empty string or nil

Str right
test = "This is a test" test = test:sub(#test - count + 1, test:len) --or test = test:reverse test = test:sub(1,count) test = test:reverse
 * Have to make decision as in case of count being greater than the length of a string or empty string or nil

Str lower
test = "Yes" test = test:lower

Str upper
test = "Yes" test = test:upper

ESCAPE LUA SPECIAL CHARACTERS
ESC = mw.ustring.gsub(SOMESTRING, '[%-%.%+%[%]%(%)%$%^%%%?%*]','%%%1')

Sandbox TEST modules created on en.wikipedia

 * 1) These are some of the Lua Modules created in Sandbox for testing/learning
 * 2) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/OSdate
 * 3) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Misc
 * 4) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Ship_prefix
 * 5) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Str_left
 * 6) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Str_right
 * 7) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Str_swap
 * 8) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/TestmvloadData
 * 9) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Ship_prefix
 * 10) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Testurlencode
 * 11) *       http://en.wikipedia.org/wiki/Module:Sandbox/Matroc/Listing

Get Wikidata id if article exists in Wikipedia

 * Battle of Hoke's Run

Get DISPLAYTITLE

 * iCarly (season 6)
 * iCarly (season 6)

Thanks
Thanks Matroc, my objective was to get all points and shapes from osm which are tagged with federal bank qid ... checked with Yurik. asif now it is not supported -- naveenpf (talk) 05:30, 5 October 2017 (UTC)

Protected Module Edit (Opinion?)
  → 2018

Given your past editing of Roman I wonder if you could point me in the right direction to get some competent eyes on this and also what you might think of  converting both ways depending on input only.

Not sure of process for getting code (as opposed to encyclopedia content) reviewed; didn't even realize there was a [|Sandbox diff] web function until after posting a static diff onto talk page.

–ASiplas (talk) 11:17, 20 February 2018 (UTC)
 * ASiplas - I don't think or remember if I edited the Roman Template - I think that perhaps the only person that I can think of to assist you would possibly be Mr. Stradivarius -- Best wishes! Matroc (talk) 00:35, 21 February 2018 (UTC)