[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: assert() and local vars
- From: "Curt Carpenter" <curtc@...>
- Date: Fri, 22 Jun 2001 10:31:00 -0700
What's wrong with the built-in assert?
From: Eric Ries [mailto:firstname.lastname@example.org]
Sent: Friday, June 22, 2001 10:19 AM
To: Multiple recipients of list
Subject: assert() and local vars
Hello all... I'm working on a wrapper for C-style asserts in Lua. I am
wondering if something like this would work:
b = a * 2
LuaAssert( "a > b" )
function LuaAssert( cmd )
local result = dostring( cmd )
if result and result > 0 then
c-style-assert( 0 )
The problem is that the locals a and b are not defined in LuaAssert...
is there some way to get around this?