aboutsummaryrefslogtreecommitdiff
path: root/testes/math.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-05-17 11:11:44 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-05-17 11:11:44 -0300
commitd9f40e3f6fb61650240c47d548bee69b24b07859 (patch)
treeab01022b3e3bc6bdb800423c97095a9423e0a798 /testes/math.lua
parent347d6961ac14213264c7176e3d125c9ba8475b01 (diff)
downloadlua-d9f40e3f6fb61650240c47d548bee69b24b07859.tar.gz
lua-d9f40e3f6fb61650240c47d548bee69b24b07859.tar.bz2
lua-d9f40e3f6fb61650240c47d548bee69b24b07859.zip
First implementation for 'const' variables
A variable can be declared const, which means it cannot be assigned to, with the syntax 'local <const> name = exp'.
Diffstat (limited to 'testes/math.lua')
-rw-r--r--testes/math.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/testes/math.lua b/testes/math.lua
index b010ff6c..c45a91ad 100644
--- a/testes/math.lua
+++ b/testes/math.lua
@@ -3,10 +3,10 @@
3 3
4print("testing numbers and math lib") 4print("testing numbers and math lib")
5 5
6local minint = math.mininteger 6local <const> minint = math.mininteger
7local maxint = math.maxinteger 7local <const> maxint = math.maxinteger
8 8
9local intbits = math.floor(math.log(maxint, 2) + 0.5) + 1 9local <const> intbits = math.floor(math.log(maxint, 2) + 0.5) + 1
10assert((1 << intbits) == 0) 10assert((1 << intbits) == 0)
11 11
12assert(minint == 1 << (intbits - 1)) 12assert(minint == 1 << (intbits - 1))