Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local strmt = getmetatable("a")
- if type(strmt.__index) ~= "table" then
- print("String[n]: Unable to load twice; or other stuff has already hooked onto strings.")
- else
- local origindex = strmt.__index
- function strmt:__index(k)
- if type(k) == "number" then
- if k > string.len(self) or k < 1 then
- return nil
- else
- print("DEBUG: !", self, k)
- return string.sub(self,k, k)
- end
- end
- return origindex[k]
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment