lean2/tests/lean/lua5.lean
Leonardo de Moura 9a5f86fce6 feat(lua): use (** ... **) instead of {{ ... }} for nested Lua scripts
The token }} is a bad delimiter for blocks of Lua script code nested in Lean files.
The problem is that the sequence }} occurs very often in Lua code because Lua uses { and } to build tables/lists/arrays.
Here is an example of Lua code that contains the sequence }}
     t = {{1, 2}, {2, 3}, {3, 4}}

In Lean, (* ... *) is used to create comments. Thus, (** ... **) code blocks will not affect
valid Lean files. It also looks reasonably good.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 16:05:49 -08:00

13 lines
No EOL
224 B
Text

Variable x : Int
(**
local N = 100
-- Create N variables with the same type of x
typeofx = env():check_type(Const("x"))
for i = 1, N do
env():add_var("y_" .. i, typeofx)
end
**)
Show Environment 101
Check x + y_1 + y_2