[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Take into account __tostring whet printing _PROMPT
- From: "Александр Машин" <traditio.ru@...>
- Date: Thu, 22 Oct 2020 10:34:44 +0700
Dear all,
Why doesn't interactive Lua takes into account the __tostring metamethod
of the non-string _PROMPT global when it prints the prompt, so that the
below code does not help to increment the prompt on any typed command,
although on any >=_PROMPT the variable is incremented?
|>_PROMPT = {no = 0}; setmetatable (_PROMPT, {__tostring = function
(self) self.no = self.no + 1; return tostring (self.no) .. ' >' end})|
https://stackoverflow.com/a/64474830/6632736
Alexander Mashin