Str.eq

From OpenEUO
Revision as of 16:34, 11 November 2010 by Ximan (Talk | contribs) (Created page with "== Calling Pattern == Call local r,c = sl.str.eq(s1,s2[,...]) Args s1...sN are strings Results r is a boolean c is a number == Usage Example == local s = sl.str local r,c...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Calling Pattern

Call

local r,c = sl.str.eq(s1,s2[,...])

Args

s1...sN are strings

Results

r is a boolean
c is a number

Usage Example

local s = sl.str
local r,c = s.eq('same','same','s@me','same')
print(tostring(r)..' '..c)
--> false 3

Description

---This function might be superfluous given that lua probably interns strings---

Checks that all given string arguments are equal at the bit level. If so, returns true and a count of the arguments passed, if not returns false as well as the index of the offending argument.

Upon Error

Eq fails silently. If eq receives fewer than two arguments or the arguments aren't strings, eq returns nil.

See Also