Commit fa0f10c
committed
lua: luaT_tolstring: keep Lua stack size unchanged
I found it counter-intuitive to change a Lua stack in a function that
returns its result as the function return value. It complicates
addressing of existing Lua stack elements using negative indices
(relatively to the stack top). In fact, the amount of those temporary
stack elements is the implementation detail. A couple of dubious
examples:
- Whether the function adds an extra element when the given value is
already a string?
- How much extra elements is added, when the __tostring metamethod
returns several values?
The original luaL_tostring() function from Lua 5.2 also left the
temporary elements on the stack, but we're not obligated to keep
bug-to-bug compatibility in a function of the luaT namespace.1 parent bc6caac commit fa0f10c
2 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1040 | 1040 | | |
1041 | 1041 | | |
1042 | 1042 | | |
| 1043 | + | |
1043 | 1044 | | |
1044 | 1045 | | |
1045 | 1046 | | |
| |||
1060 | 1061 | | |
1061 | 1062 | | |
1062 | 1063 | | |
1063 | | - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
1064 | 1067 | | |
1065 | 1068 | | |
1066 | 1069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1986 | 1986 | | |
1987 | 1987 | | |
1988 | 1988 | | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
1989 | 1993 | | |
1990 | 1994 | | |
1991 | 1995 | | |
| |||
2012 | 2016 | | |
2013 | 2017 | | |
2014 | 2018 | | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
2015 | 2034 | | |
2016 | 2035 | | |
2017 | 2036 | | |
| |||
0 commit comments