diff options
| author | jussi | 2024-04-17 00:35:58 +0300 |
|---|---|---|
| committer | jussi | 2024-04-17 00:35:58 +0300 |
| commit | 70b40f67824b3d612235c382aa83821c054fa51e (patch) | |
| tree | 5d594cc457d6fed8af87e31977a0b9352677a4f5 /examples/resources/lib/rune.lua | |
| parent | 41b67398247d9031aed4ca6e3ffd6799ec8b1bca (diff) | |
| download | reilua-enhanced-70b40f67824b3d612235c382aa83821c054fa51e.tar.gz reilua-enhanced-70b40f67824b3d612235c382aa83821c054fa51e.tar.bz2 reilua-enhanced-70b40f67824b3d612235c382aa83821c054fa51e.zip | |
Object libraries like Vector2 optimizations.
Diffstat (limited to 'examples/resources/lib/rune.lua')
| -rw-r--r-- | examples/resources/lib/rune.lua | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/examples/resources/lib/rune.lua b/examples/resources/lib/rune.lua index fa9f59d..12bf72d 100644 --- a/examples/resources/lib/rune.lua +++ b/examples/resources/lib/rune.lua @@ -21,27 +21,15 @@ local metatable = { } function Rune:new( string ) - if type( string ) == "table" then - string = RL.LoadUTF8( string ) - elseif type( string ) == "nil" then - string = "" - end - local object = setmetatable( {}, metatable ) - object.string = string + object.string = string or "" return object end function Rune:set( string ) - if type( string ) == "table" then - string = RL.LoadUTF8( string ) - elseif type( string ) == "nil" then - string = "" - end - - self.string = string + self.string = string or "" end function Rune:clone() @@ -57,12 +45,12 @@ function Rune:getCodepoints() end function Rune:getCodepoint( index ) - local codepoint = RL.GetCodepoint( self:sub( index, index ) ) + local codepoint = RL.GetCodepoint( self.string, index ) return codepoint end function Rune:getCodepointSize( index ) - local _, codepointSize = RL.GetCodepoint( self:sub( index, index ) ) + local _, codepointSize = RL.GetCodepoint( self.string, index ) return codepointSize end |
