mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: textbox methods line numbers startfrom 0
This commit is contained in:
parent
31ea198301
commit
637896fb0f
1 changed files with 2 additions and 2 deletions
|
|
@ -173,7 +173,7 @@ static int l_get_line_at(lua::State* L) {
|
|||
auto node = get_document_node(L, 1);
|
||||
auto position = lua::tointeger(L, 2);
|
||||
if (auto box = dynamic_cast<TextBox*>(node.node.get())) {
|
||||
return lua::pushinteger(L, box->getLineAt(position));
|
||||
return lua::pushinteger(L, box->getLineAt(position) + 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ static int l_get_line_y(lua::State* L) {
|
|||
auto node = get_document_node(L, 1);
|
||||
auto line = lua::tointeger(L, 2);
|
||||
if (auto box = dynamic_cast<TextBox*>(node.node.get())) {
|
||||
return lua::pushinteger(L, box->getLineYOffset(line));
|
||||
return lua::pushinteger(L, box->getLineYOffset(line - 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue