lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> It would be pretty simple to add another case for strings (or 
> any other object type) in luaT_gettmbyobj() at the end of 
> ltm.c. You'd need to set up a metatable first (probably in 
> the string library), put it into the registry (or anchor it 
> at the global state) and return it here.

LuaPlus does this, if anybody needs full implementation details.  Most is in
ltm.c, but there are a couple extra items in lvm.c, lstate.c/h and possibly
lbaselib.c, as I recall.  And, since LuaPlus also supports wide character
strings, the method of string access is identical, making my life much
easier:

s = "Hello"
print(s:len())
print(s:find("el"))

s = L"Hello"
print(s:len())
print(s:find(L"el"))

Josh