From 8c52d47692b4ede03a5f5ab744e99c0bb36ed9a9 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Wed, 13 Nov 2013 13:58:51 -0800 Subject: [PATCH] chore(lua): rename env() to get_env() Signed-off-by: Leonardo de Moura --- src/bindings/lua/environment.cpp | 2 +- tests/lean/lua4.lean | 5 +++-- tests/lean/lua5.lean | 7 ++++--- tests/lean/lua8.lean | 7 ++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/bindings/lua/environment.cpp b/src/bindings/lua/environment.cpp index 097644e5e..dca82ac8c 100644 --- a/src/bindings/lua/environment.cpp +++ b/src/bindings/lua/environment.cpp @@ -250,6 +250,6 @@ void open_environment(lua_State * L) { SET_GLOBAL_FUN(mk_environment, "environment"); SET_GLOBAL_FUN(environment_pred, "is_environment"); SET_GLOBAL_FUN(get_environment, "get_environment"); - SET_GLOBAL_FUN(get_environment, "env"); + SET_GLOBAL_FUN(get_environment, "get_env"); } } diff --git a/tests/lean/lua4.lean b/tests/lean/lua4.lean index d5a0ba7be..36c6baa1e 100644 --- a/tests/lean/lua4.lean +++ b/tests/lean/lua4.lean @@ -4,9 +4,10 @@ Variable x : Int -- Add a variable to the environment using Lua -- The type of the new variable is equal to the type -- of x -typeofx = env():check_type(Const("x")) +local env = get_environment() +typeofx = env:check_type(Const("x")) print("type of x is " .. tostring(typeofx)) -env():add_var("y", typeofx) +env:add_var("y", typeofx) **) Check x + y diff --git a/tests/lean/lua5.lean b/tests/lean/lua5.lean index ae0e18ec8..2277c93a3 100644 --- a/tests/lean/lua5.lean +++ b/tests/lean/lua5.lean @@ -1,11 +1,12 @@ Variable x : Int (** -local N = 100 +local N = 100 +local env = get_environment() -- Create N variables with the same type of x -typeofx = env():check_type(Const("x")) +typeofx = env:check_type(Const("x")) for i = 1, N do - env():add_var("y_" .. i, typeofx) + env:add_var("y_" .. i, typeofx) end **) diff --git a/tests/lean/lua8.lean b/tests/lean/lua8.lean index ac1dd8a53..7bd3c3973 100644 --- a/tests/lean/lua8.lean +++ b/tests/lean/lua8.lean @@ -1,13 +1,14 @@ Variable x : Int (** -ty_x = env():check_type(Const("x")) +local env = get_environment() +ty_x = env:check_type(Const("x")) c = context() c = context(c, "x", ty_x) c = context(c, "y", ty_x) print(c) -o = env():find_object("x") +o = env:find_object("x") print(o) -o = env():find_object("y") +o = env:find_object("y") print(o) **) \ No newline at end of file