lua-users home
lua-l archive

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

> > > I'm having some stack underflow problems; I'm not sure if it's
> > > something I'm doing wrong, or a bug in 5.0 alpha.
> >
> > Yes, this is a bug. Because this code is now for 
> compatibility only, we
> > did not test it hard. Sorry about that.
> What is the now supported way of executing a string?
> I really only use this in a couple of places, so it would probably be
> easiest for me to just change it to a call that will work as expected.

function do_ (f, err)
  if not f then print(err); return end
  local a,b = pcall(f)
  if not a then print(b); return nil
  else return b or true

function dostring(s) return do_(loadstring(s)) end

from compat.lua in lua5 test directory.