diff options
| author | jussi | 2024-04-13 18:44:42 +0300 |
|---|---|---|
| committer | jussi | 2024-04-13 18:44:42 +0300 |
| commit | 1d66edf4f2390c25485ef4205b20c184de1c2f5d (patch) | |
| tree | 7a3cd79e26d7b93a2fb4a3764171fbe90d22a9d4 /src/text.c | |
| parent | b96960a1f97f815a6872fedc422ea950ed477cda (diff) | |
| download | reilua-enhanced-1d66edf4f2390c25485ef4205b20c184de1c2f5d.tar.gz reilua-enhanced-1d66edf4f2390c25485ef4205b20c184de1c2f5d.tar.bz2 reilua-enhanced-1d66edf4f2390c25485ef4205b20c184de1c2f5d.zip | |
Position argument added for GetCodepoint, GetCodepointNext and GetCodepointPrevious.
Diffstat (limited to 'src/text.c')
| -rw-r--r-- | src/text.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1086,7 +1086,7 @@ int ltextGetCodepointCount( lua_State* L ) { } /* -> codepoint, codepointSize = RL.GetCodepoint( string text ) +> codepoint, codepointSize = RL.GetCodepoint( string text, int position ) Get codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure @@ -1094,6 +1094,9 @@ Get codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure */ int ltextGetCodepoint( lua_State* L ) { const char* text = luaL_checkstring( L, 1 ); + int position = luaL_checkinteger( L, 2 ); + + text += position; int codepointSize = 0; lua_pushinteger( L, GetCodepoint( text, &codepointSize ) ); @@ -1103,7 +1106,7 @@ int ltextGetCodepoint( lua_State* L ) { } /* -> codepoint, codepointSize = RL.GetCodepointNext( string text ) +> codepoint, codepointSize = RL.GetCodepointNext( string text, int position ) Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure @@ -1111,6 +1114,9 @@ Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure */ int ltextGetCodepointNext( lua_State* L ) { const char* text = luaL_checkstring( L, 1 ); + int position = luaL_checkinteger( L, 2 ); + + text += position; int codepointSize = 0; lua_pushinteger( L, GetCodepointNext( text, &codepointSize ) ); @@ -1120,7 +1126,7 @@ int ltextGetCodepointNext( lua_State* L ) { } /* -> codepoint, codepointSize = RL.GetCodepointPrevious( string text ) +> codepoint, codepointSize = RL.GetCodepointPrevious( string text, int position ) Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure @@ -1128,6 +1134,9 @@ Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failu */ int ltextGetCodepointPrevious( lua_State* L ) { const char* text = luaL_checkstring( L, 1 ); + int position = luaL_checkinteger( L, 2 ); + + text += position; int codepointSize = 0; lua_pushinteger( L, GetCodepointPrevious( text, &codepointSize ) ); |
