[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: assert() and local vars
- From: "Eric Ries" <eries@...>
- Date: Fri, 22 Jun 2001 10:18:51 -0700
Hello all... I'm working on a wrapper for C-style asserts in Lua. I am
wondering if something like this would work:
function foo(a)
local b
b = a * 2
... etc
LuaAssert( "a > b" )
... etc
end
function LuaAssert( cmd )
local result = dostring( cmd )
if result and result > 0 then
c-style-assert( 0 )
end
end
The problem is that the locals a and b are not defined in LuaAssert... is
there some way to get around this?