lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

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

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?