Left() Right() and Lua

Posted by Gore on Mon 29 Jan 2007 05:15 PM — 2 posts, 18,068 views.

#0
I've tried looking through the Lua documentation for equivelents of VBScript's Left() and Right(), but I can't seem to find them.

Is string.gsub() all I have to work with?
USA #1
You might want to check string.sub. It does both of them at once.

string.sub(s, 1, 5) gets the first 5 characters.

string.sub(s, -5) gets the last 5 characters.

See:
http://www.lua.org/manual/5.1/manual.html#pdf-string.sub