lua-users home
lua-l archive

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


A simpler version could be simply this:

void my_dostring(lua_State *L, const char *cmd)
{
    if (luaL_loadbuffer(L, cmd, strlen(cmd), cmd) || 
        lua_pcall(L, 0, LUA_MULTRET, 0)) {
      fprintf(stderr, "%s\n", lua_tostring(L, -1));
      lua_pop(L, 1);
    }
}


As lhf pointed out, you don't have to call _ALERT. (Actually, lua does
not define _ALERT anymore, so if you want to call it, you have to define
it.)

-- Roberto