It looks fine to me, though you might want to look into lua_error instead of assert .